PHP Classes

File: usage.php

Recommend this page to a friend!
  Classes of P Guardiario   PHP Str Match and Split   usage.php   Download  
File: usage.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Str Match and Split
Process strings with regular expressions
Author: By
Last change: Update of usage.php
Date: 1 year ago
Size: 315 bytes
 

Contents

Class file image Download
<?php
require 'phpstr.php';
echo
str('There are 23 people reading this blog')->match('/\d+/') . "\n";
echo
str('all of the es')->gsub('/e/', 'y') . "\n";
echo
str('just the first e')->sub('/e/', 'y') . "\n";
var_dump(str('010 202 312 332')->scan('/\d+/'));
var_dump(str('010 202-312 332')->split('/\s/'));
?>