PHP Classes


Recommend this page to a friend!
  Classes of P Guardiario  >  PHP Str Match and Split  >  >  Download  
Role: Documentation
Content type: text/plain
Description: Documentation
Class: PHP Str Match and Split
Process strings with regular expressions
Author: By
Last change: initial commit
initial commit
Initial commit
Date: 9 months ago
Size: 571 bytes


Class file image Download
Give php strings easy to remember regex functionality

Do you ever get tired of looking up preg functions because you forgot the order of the arguments? Me too.

require 'phpstr.php';

Return a match
str('There are 23 people reading this blog')->match('/\d+/');

str('all of the es')->gsub('/e/', 'y');

Scan will return an array of matches
str('010 202 312 332')->scan('/\d+/');

Split will return an array of tokens
str('010 202-312 332')->split('/\s/');
For more information send a message to info at phpclasses dot org.