I have string like below which is coming from DB.
$temp=Array(true);
if($x[211] != 15)
$temp[] = 211;
if($x[224] != 1)
$temp[] = 211;
if(sizeof($temp)>1) {
$temp[0]=false;
}
return $temp;
I need to find all the values inside square brackets followed by $x variable. I.e 211 and 224 .
I tried below code which i found in this website as an answer, but it returns all the values in square bracket including the one followed $temp variable.
preg_match_all("/\[(.*?)\]/", $text, $matches);
print_r($matches[1]);
Please let me know how can i get this desired results ?