Home >Backend Development >PHP Tutorial >spliti和ereg用新函数preg_split(),preg_match()怎么重写下面两句话

spliti和ereg用新函数preg_split(),preg_match()怎么重写下面两句话

WBOY
WBOYOriginal
2016-06-23 13:29:271044browse

1,$sql=select * from huiyuan where id=1;
       list($sel, $sql) = spliti("FROM", $sql);


2,if (!ereg("^[0-9]+$",$id12) {$a=1;}


回复讨论(解决方案)

1、

 list($sel, $sql) = preg_split("/FROM/i", $sql);

2、
if (!preg_match("/^[0-9]+$/",$id12)) {$a=1;}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn