Re: New string functions: str_startswith() and str_endswith()
| From: | Rasmus Lerdorf | Date: | Mon, 21 Jul 2008 16:26:02 +0000 |
| Subject: | Re: New string functions: str_startswith() and str_endswith() | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-39131@lists.php.net to get a copy of this message | ||
Brian Moon wrote:
Stan Vassilev | FM wrote:It also isn't any shorter: if(str_endswith($path,'.php')) vs. if(substr($path,-4)=='.php') And there would be no performance gain since it can be done in a single call now and the code would do pretty much exactly what substr does. -RasmusI'm particularly for begins/endswith() function as I do this all over my code and I'd appreciate the simplification and free extra performance.I really don't mean to be rude here, but shorter and less typing !== performance gain. The PHP string functions are very fast. And if you are looking to improve your applications performance by using different string functions, you are likely looking in the wrong place.