Skip to content

Instantly share code, notes, and snippets.

@kdambekalns
Created July 12, 2012 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kdambekalns/3098900 to your computer and use it in GitHub Desktop.
Save kdambekalns/3098900 to your computer and use it in GitHub Desktop.
Comparison of substr and substr_compare
<?php
$className = 'FLOW3_Foo_Bar_Original';
for ($i = 0 ; $i < 1000000; $i++) {
substr($className, -9) === '_Original';
}
<?php
$className = 'FLOW3_Foo_Bar_Original';
for ($i = 0 ; $i < 1000000; $i++) {
substr_compare($className, '_Original', 1, 9);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment