Mega Code Archive

 
Categories / Php / Strings
 

Get the start and end of the string when m is enabled, you should use A and z, like this

preg_match("/\AThis/m", $multitest);     // returns true if the string starts with "This" (true)     preg_match("/symbol\z/m", $multitest);     // returns true if the string ends with "symbol" (false)