如何迭代循环内搜索字符串固定的关键字后的任何单词? [英] How to iterate loop inside a string searching for any word aftera fixed keyword?
问题描述
好的这是字串 BEGIN IF(NEW.name!= OLD.name)然后插入到jos_menuaudit set menuid = OLD.id ,oldvalue = OLD.name,newvalue = NEW.name,field =name; END IF; IF(NEW.alias!= OLD.alias)THEN INSERT INTO jos_menuaudit set menuid = OLD.id,oldvalue = OLD.alias, newvalue = NEW.alias,field =alias; END IF; END
其中我搜索 IF(NEW。
,并在此之后特殊的其他字符串不应该显示,因此无论何时在循环中,它发现 IF(NEW。
我musr得到一个字旁边。并以这种方式一个数组应该准备好使用。
$ str =PHP Paddy,PHP Pranav,PHP Parth;
$ ary = explode(',',$ str);
foreach($ ary as $ str){
echo substr($ str,4);
}
Suppose I have a sting as "PHP Paddy,PHP Pranav,PHP Parth", now i have a count as 3,now how should I iterate loop in the string aiming on string after "PHP " to display the all the names?
Alright This is the string "BEGIN IF (NEW.name != OLD.name) THEN INSERT INTO jos_menuaudit set menuid=OLD.id, oldvalue = OLD.name, newvalue = NEW.name, field = "name"; END IF; IF (NEW.alias != OLD.alias) THEN INSERT INTO jos_menuaudit set menuid=OLD.id, oldvalue = OLD.alias, newvalue = NEW.alias, field = "alias"; END IF; END
" in which i am searching the particular word after " IF (NEW.
", and after that particualar others strings should not b displayed, hence whenever in a loop it finds " IF (NEW.
" I musr get a word just next to it. and in this way an array should b ready for to use.
$str = "PHP Paddy,PHP Pranav,PHP Parth";
$ary = explode(',', $str);
foreach($ary as $str){
echo substr($str, 4);
}
这篇关于如何迭代循环内搜索字符串固定的关键字后的任何单词?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!