Revision: 12524
Updated Code
at August 8, 2009 11:20 by Vordreller
Updated Code
function startsWith($haystack,$needle,$case=true) { if($case){return (strcmp(substr($haystack, 0, strlen($needle)),$needle)===0);} return (strcasecmp(substr($haystack, 0, strlen($needle)),$needle)===0); }
Revision: 12523
Updated Code
at August 8, 2009 11:18 by Vordreller
Updated Code
function startsWith($haystack,$needle,$case=true) { if($case){return (strcmp(substr($haystack, 0, strlen($needle)),$needle)===0);} return (strcasecmp(substr($haystack, 0, strlen($needle)),strtolower($needle))===0); }
Revision: 12522
Updated Code
at July 23, 2009 16:32 by Vordreller
Updated Code
function startsWith($haystack,$needle,$case=true) { if($case){return (strcmp(substr($haystack, 0, strlen($needle)),$needle)===0);} return (strcmp(strtolower(substr($haystack, 0, strlen($needle))),strtolower($needle))===0); }
Revision: 12521
Updated Code
at July 23, 2009 16:32 by Vordreller
Updated Code
function startsWith($haystack,$needle,$case=true) { if($case){return (strcmp(substr($haystack, 0, strlen($needle)),$needle)===0);} return(strcmp(strtolower(substr($haystack, 0, strlen($needle))),strtolower($needle))===0); }
Revision: 12520
Updated Code
at May 7, 2009 10:33 by Vordreller
Updated Code
function startsWith($haystack,$needle,$case=true) { if($case){return(substr($haystack, 0, strlen($needle)) === $needle);} return(strtolower(substr($haystack, 0, strlen($needle))) === strtolower($needle)); }
Revision: 12519
Updated Code
at March 24, 2009 07:41 by Vordreller
Updated Code
function startsWith($haystack,$needle,$case=true) { if($case){return(substr($haystack, 0, strlen($needle)) === $needle);} if(!$case){return(strtolower(substr($haystack, 0, strlen($needle))) === strtolower($needle));} }
Revision: 12518
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 17, 2009 23:07 by Vordreller
Initial Code
function startsWith($haystack,$needle,$case=true) { if($case){return(substr($haystack, 0, strlen($needle)) === $needle);} if(!$case){return(strtolower(substr($haystack, 0, strlen($needle))) === strtolower($needle));} }
Initial URL
Initial Description
The counterpart of this snippet: [http://snipplr.com/view/13213/check-if-a-string-ends-with-another-string/][1] This one checks if a strings begins with another string. Again, third paramter is optional, if you don't set it, the comparison will be case-sensitive. [1]: http://snipplr.com/view/13213/check-if-a-string-ends-with-another-string/
Initial Title
Check if a string begins with another string
Initial Tags
Initial Language
PHP