我在项目中有这个问题
$line = substr($line,8);
$LIT_YARN = '".*"';
$VAR_NAME = '[A-Za-z][a-zA-Z0-9]*';
$TEMP2 = "/($LIT_YARN|$VAR_NAME)/";
$line = trim($line);
preg_match_all($TEMP2,$line,$params);
var_dump($params[0]);
简单的输入是
" "askdj" "asjdk" "asdasndw" "
复杂的输入是
" "asd" Y "asd" X "
变量也可以输入
简单的输入导致单个字符串
params[0] => "askdj" "asjdk" "asdasndw"
我期待这样
params[0] => "askdj"
params[1] => "asjdk"
params[2] => "asdasndw"
复杂的输入应该导致
params[0] => "asd"
params[1] => 'Y'
params[2] => "asd"
params[3] => 'X'
包括作为变量的 X 和 Y
我该怎么做?