Posted By

archvi on 01/23/12


Tagged

String


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Priestd09


startswith


 / Published in: PHP
 

Similiar to python string.startswith

  1. /**
  2.  * return bool
  3.  **/
  4. function startswith($char, $string)
  5. {
  6. return (substr($string, 0, strlen($char)) == $char ) ? true : false;
  7. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: keithbluhm on January 26, 2012

return 0 === strpos( $string, $char );

You need to login to post a comment.