Use explode in php to check whether a character exists. This method can also be used to determine whether the separator is available. For example, copy the code as follows :? Phpif ($ _ MODULE [tg1_tjly]) {$ tg1_tjlyexplode (|, $ _ MODULE [tg1_tjly])
PHP//define a function with a default value functionMain3 ($f=5,$g=6) { Echo $f*$g; } Main3 (2,3); Echo""; //functions with variable parameters (the number of parameters can be changed) functionMain4 () { for($i= 0;$iFunc_num_args();$i++) {
PHP can divide the string into an array, and also can be connected to the string, and the exact connection of the array elements into a string, with these two functions we can be between the array and the string of free conversion, see the example
Array explode (string $ separator, string $ string [, int $ limit])
This function has three parameters. The first parameter $ separator sets a delimiter (string ). The second parameter $ string specifies the string to be operated. The $ limit
First look at the definition of two methods:
Function prototype: Array split (String $pattern, string $string [, int $limit])
Function prototype: array explode (string $separator, string $string [, int $limit])
At first glance there is no
Explode cut the foreach loop output, and add a condition containing a certain character to not output this group
$ Navinfor [down] = 'AAA $ http: // $ ccc $ ddd '; $ downzu = explode ("$ ", $ navinfor [down]); foreach ($ downzu as $ k = >$ v) {$
Array explode (string $ separator, string $ string [, int $ limit])
This function has three parameters. The first parameter $ separator sets a delimiter (string ). The second parameter $ string specifies the string to be operated. The $ limit
Split supports regular expressions
========================================================== ==============
The explode function can only be separated by characters. However, the split function uses regular expressions. Of course, the split
Substr (STR, start, length );
Example: substr ('php is very good language );
Output is ve;
If the length of Start> STR is returned ();
Substr ('php is very good language );
Substr ('php is very good language ',4);
Output as (blank)
First, let's take a look at the definitions of the two methods:Function prototype: array split (string $ pattern, string $ string [, int $ limit])Function prototype: array explode (string $ separator, string $ string [, int $ limit])There is no
Explode (symbols, characters)
The characters processed by explode will eventually be saved in an array form, so let's take a look at an example below.
$t = ' 9,133, Dan County ^14,203, Changsha ^14,206, Hengyang ';
$ar = Explode (', ', $a);
For the use of the PHP split string explode function, using the EXPLODE function to split the string into an array, here is a summary of a few examples that need a friend to refer to.
PHP array and explode function application examples, for
Array explode (string $separator, string $string [, int $limit])
The function has 3 parameters, and the first parameter $separator sets a split character (string). The second parameter $string specifies the string to manipulate. The $limit
Use of PHP explode function, this is my own use of explode
if (!empty ($CT)) {
if (Strpos ($ct, "|") ===false) {
mysql_query ($sql) or Die (Mysql_error ());
Exit (" ");
}else{
$ex =explode ("|", $CT);
for ($i =0; $i
$r =mysql_query ("select
Today I updated my fkqq program. One of my PHP files receives the string of the hq qq number. Because the obtained content has a large amount of junk content, I use str_replace TO MAKE A processing Code as follows:
$xx1 =
Why do the EIA and the big market when others make a profit and you explode a position? Investment and financial management is not the overnight of the matter, the previous loss, does not represent the late loss, the previous profit, does not
Use of implode and explode. The implode function converts an array into a string, which is used to combine SQL statements! For example, $ aarray (a, B, c); $ bimplode (, $ a); echo $ B; the returned string is the, B, c implode function that converts
To facilitate input and reduce the number of text boxes that appear when the decoration and editing module is used, you need to enter two or three different content in one box, and then use some special characters to separate them, use explode to
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.