In your question $arr is the array. First we’ll check if ‘Action’ is in the array.
if(in_array('Action',$arr)){
//in_array checks if 'Action' is in the array
echo "Action is in the array!";
}
Now we need to “implode” the array to turn it into a string.
echo "(" . implode(',', $arr) . ")";
//implode glues the parts of your array together into a string using the supplied "glue", in this case a comma.
php.net has it all documented, but I know it’s hard to just know what a function name is, especially something cryptic like implode. When you’re learning it’s nice to get a friendly answer.
6
solved PHP : Check and Read from array [duplicate]