只能是
Array
(
[0] => abc " cd'Ia;m " hello
[1] => good morning 'oh ";my god'
[2] => good night "I am'; boy"
[3] => you "are" a girl ';thank" you' very much
[4] =>
)
... girl ';thank" you' very much;
^__这个“;”不是在成对的单引号中吗?<?php
$txt =<<< TEXT
abc " cd'Ia;m " hello ; good morning 'oh ";my god' ; good night "I am'; boy"; you "are" a girl ';thank" you' very much;
TEXT;function stack($v='') {
static $st = array();
if($v == '')
if($st) return array(count($st),array_pop($st));
else return false;
array_push($st,$v[0]);
return '_STACK_'.count($st).'_';
}$t = preg_replace_callback('/([\'"]).*\\1/U','stack',$txt);
$ar = split(';',$t);
$t = join('`',$ar);
while($v=stack())
$t = str_replace("_STACK_$v[0]_",$v[1],$t);
$ar = split('`',$t);
print_r($ar);
?>
Array
(
[0] => abc " cd'Ia;m " hello
[1] => good morning 'oh ";my god'
[2] => good night "I am'; boy"
[3] => you "are" a girl ';thank" you' very much
[4] =>
)
... girl ';thank" you' very much;
^__这个“;”不是在成对的单引号中吗?<?php
$txt =<<< TEXT
abc " cd'Ia;m " hello ; good morning 'oh ";my god' ; good night "I am'; boy"; you "are" a girl ';thank" you' very much;
TEXT;function stack($v='') {
static $st = array();
if($v == '')
if($st) return array(count($st),array_pop($st));
else return false;
array_push($st,$v[0]);
return '_STACK_'.count($st).'_';
}$t = preg_replace_callback('/([\'"]).*\\1/U','stack',$txt);
$ar = split(';',$t);
$t = join('`',$ar);
while($v=stack())
$t = str_replace("_STACK_$v[0]_",$v[1],$t);
$ar = split('`',$t);
print_r($ar);
?>
sql语句是用;来表示结束,但是sql语句中的字符串是用双引号或者单引号来表示的,
但是字符串本身不能控制它是否包含双引号,单引号或者;
girl ';thank" you' very much";
那么你说他是谁包含了谁呢?
等我研究一下唠叨的办法
谁还有什么想法?