Home startsWith() and endsWith() functions in PHP
Reply: 0

startsWith() and endsWith() functions in PHP

user300
1#
user300 Published in June 25, 2018, 3:59 am

How can I write 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
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.489952 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO