PHP startsWith() and endsWith() functions

Posted by Click Upvote on Stack Overflow See other posts from Stack Overflow or by Click Upvote
Published on 2009-05-07T12:14:27Z Indexed on 2010/05/30 0:52 UTC
Read the original article Hit count: 213

Filed under:
|
|

I need two functions that would take a string and return if it starts with the specified character/string or ends with it.

For example:

$str='|apples}';

echo startsWith($str,'|'); //Returns true
echo endsWith($str,'}'); //Returns true

© Stack Overflow or respective owner

Related posts about php

Related posts about string