我有这个字符串
$s = 'Yo be [diggin = array("fruit"=> "apple")] scriptzors!';
然后被检查
$matches = null;
preg_match_all('/\[(.*?)\]/', $s, $matches);
var_dump($matches[1]);
但我想要它做的是以下,它应该返回以下
print "yo be";
$this->diggin(SEND ARRAY HERE);
print "scriptzors!";
编辑以显示以下答案的问题
$s = 'Yo be [diggin = array("fruit"=>"apple")] scriptzors!';
$matches = null;
preg_match_all('/\[(.*?)\]/', $s, $matches);
$var = explode(' = ', $matches[1]);
print $var[0]; //THIS DOES NOT PRINT