Ah, I missed that. If we had ranges (e.g. $string[0..4] or $string[-1..4])
that'd work, but we don't.
Now I see some value in the function, though still perhaps not enough to
justify above and beyond strpos etc.
On Tue, Jul 26, 2016 at 5:11 PM, wrote:
> Davey,
>
> Thanks
Davey,
Thanks for joining the conversation! That code snippet is very elegant,
and it is a superb way of checking if a string starts with or ends with
a specific character. However, it does not check if a string starts with
or ends with a specific string, containing multiple characters.
Will,
Now that we have generalized support for negative string offsets you can
now just do:
$string = "/foo/bar/bat/";
if ($string[0] === "/") { // fully-qualified path }
if ($string[-1] === "/") { // trailing "/" }
This avoids the overhead of a function call, arguably is as expressive, and
a
Thanks for replying David.
Thanks for the questions, its good to elaborate on things some. I'll
address each question here:
1. No, I guess this is my first time reaching out to the community. I
had gone with str_begins and str_ends because it fit some of the current
naming approaches. I
Questions:
1.
Have you talked with this list about the terms of you suggestions?
(like str_begins, str_starts, strstarts, strbegins, str_ends,
strends...)
Is yes, sorry, I do not received this topic before.
2.
There some valid performance advantage over strpos()?
3.
And about the "market" for
Hello,
I would like to submit an RFC for adding a str_begins and str_ends
function, in relation to https://bugs.php.net/bug.php?id=67035 and
https://bugs.php.net/bug.php?id=50434. I've added those functions on my
local PHP copy. I would like to make an RFC and a PR for adding it to
the core
On 26.07.2016 at 15:15, Michael Vostrikov wrote:
>> The RFC speaks of *operator*, where actually start-tags[1] are meant, to
> start with.
>> Using the word operator is rather confusing in this context.
>
> Technically yes, but there are echo operator, so it can be considered as
> special
Previously you wrote about PHP as a lang only. There was an RFC
https://wiki.php.net/rfc/script_only_include about dissallow opening tags
in require statements - personally I'd love to see it in PHP it could
minimize affect af featores like operator we're talking about to just
templates.
26 lip
>> if ($context == 'html') {
> this is bad coding style since $context = 0 gives unexpected html
escaping.
I know, it was just an example)
> The RFC speaks of *operator*, where actually start-tags[1] are meant, to
start with.
> Using the word operator is rather confusing in this context.
> PHP today is a programming language, and applications and libraries can
be and are written in that programming language.
PHP has and tags, all outside these tags is considered as
HTML. It is needed or to remove these tags and use PHP as programming
language only, or to improve usage of these
Results for project PHP master, build date 2016-07-26 06:29:46+03:00
commit: 91f22a2
previous commit:abb228e
revision date: 2016-07-25 23:04:25+02:00
environment:Haswell-EP
cpu:Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores,
stepping 2, LLC 45 MB
11 matches
Mail list logo