Re: RFC Posted for str_begins and str_ends functions

From: Date: Thu, 18 Aug 2016 11:39:55 +0000
Subject: Re: RFC Posted for str_begins and str_ends functions
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-95292@lists.php.net to get a copy of this message
On 13/08/2016 08:42, Lester Caine wrote:
Is starting just a Firebird SQL thing or is it more generally available. I do a few google searches but as usual when searching for things like 'starting' one gets hundreds of pages on 'running' the software and it's other connotations.
I've never come across it in Postgres, MS SQL Server, or MySQL. Generally LIKE 'abc%' is the recommended approach (and will I think hit the index in many cases, because the DBMS can optimize the case of a prefix match if it knows at planning time). A "starting" keyword would certainly be useful if it was there. :) It doesn't quite fill the same need as a PHP function, of course, because you might be checking user input, or API results, or all sorts of things that won't, or haven't yet, hit the database. Currently the common idiom for that is the ugly strpos($string, 'abc') === 0 Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#95292) next »