Parsing a string in PHP using regular expressions

It is possible to parse a string in PHP using regular expressions. This is done using preg_match function. This function takes three arguments. First one is regular expression pattern, second one is a string where a match is to be looked for, and the third argument is a variable to hold the result of this operation. If this operation is successful, then the third argument will be populated with matches of the regular expression.

Result of this function is a count of how many matches were found. Ig no matches were found then the result of this operation will be 0, or in terms of Boolean values, it is False.

Comments

Popular posts from this blog

Absolute and relative path in HTML pages

Errors

goto PHP operator