In the php Tutorial, use explode to check whether a character exists.
Explode (string separator, string [, int limit])
Separator is a null string (""), and explode () returns FALSE. If the value of separator cannot be found in string, explode () returns an array containing a single string element.
*/
// Explode instance 1
$ Explode = "aaa, bbb, ccc, ddd, explode, jjjj ";
$ Array = explode (',', $ explode );
Print_r ($ array );
/*
Result:
Array
(
[0] => aaa
[1] => bbb
[2] => ccc
[3] => ddd
[4] => explode
[5] => JJJJJ
)
*/
// We can use the explode and end functions when processing the date or getting the file extension. The following shows the example.
$ File = "www.111cn.net.gif ";
$ ExtArray = explode ('.', $ file );
$ Ext = end ($ extArray );
Echo $ ext;
/*
Output value: .gif
Use explode to find whether a character exists
<? Php
If ($ _ MODULE [tg1_tjly]) {
$ Tg1_tjly = explode ("|", $ _ MODULE [tg1_tjly]);
If (count ($ tg1_tjly)> 1) {// here, when the statistical array is greater than 1, it indicates that it contains one or more interval symbols "| ".
$ Tg1_tjly_tit = $ tg1_tjly [0];
$ Tg1_tjly_con = $ tg1_tjly [1];
} Else {
$ Tg1_tjly_tit = 'reason for recommendation ';
$ Tg1_tjly_con =$ _ MODULE [tg1_tjly];
}
} Else {
$ Tg1_tjly_tit = 'Enter the Recommendation reason title ';
$ Tg1_tjly_con = 'Enter the content of the Recommendation reason. ';
}
?>