Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $text="testing:this is a test";
- $text="testing:this is a test";
- $start=microtime(1);
- for ($c=0;$c!=100000;$c++) find1($text);
- $time1=microtime(1)-$start;
- $start=microtime(1);
- for ($c=0;$c!=100000;$c++) find2($text);
- $time2=microtime(1)-$start;
- echo "find1 = $time1\n";
- echo "find2 = $time2\n";
- function find1($text,$separator=':') {
- $after=substr($text,strpos($text,$separator)+1);
- return $after;
- }
- function find2($text,$separator=':') {
- $tmp=explode($separator,$text);
- return $tmp[1];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement