On 25 September 2021 22:22:51 BST, Daniele B <my2...@aol.com> wrote:
Rowan, I did the bithday party of my two years old daughter yesterday.. if I
knew before I wrote you about this topic a couple of days ago to invite you all
to the party.. ; ) I'm not here exacly to meet up you my github account..
Well, since your github account is already linked at the bottom of all
your e-mails, I'm not sure what the concern is, but github gists was
just one suggestion. My point was that there are plenty of places online
where you could post the code you were trying to share, and then you
wouldn't have to fit it into an e-mail.
I also invested a good half of day about this *simplification* topic.. sorry.
Sure, and I have invested time trying to understand what you're
proposing, and to help you make your case to other people. If you
succeed, other people will be investing time to implement these
functions, and document and maintain them. As the saying goes: there is
no such thing as a free lunch.
About the "magic" tilde is nothing else an help to not break in the 0 position
OK. The correct way to do that, as mentioned in the manual for strpos(),
is to do a strict comparison against false. So your function can be
written as:
function str_place(string $haystack, string $needle): string
{
if ( mb_stripos($haystack, $needle) !== false ) {
return $needle;
}
else {
return PHP_STR;
}
}
Or more concisely:
function str_place(string $haystack, string $needle): string
{
return mb_stripos($haystack, $needle) === false ? PHP_STR : $needle;
}
I've still no idea what PHP_STR is, what the function name means, or
when it is useful, though.
about the rest of your comments are merely about your aesthetic tast that
probably is different from mine
I'm not saying I don't *like* these functions, I'm saying I genuinely
don't know what they do.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php