Home
last modified time | relevance | path

Searched hist:"12 dd3cbcf3c49223eacbd75f1d4ae9c83b326deb" (Results 1 – 1 of 1) sorted by relevance

/dokuwiki/inc/
H A Dcommon.php12dd3cbcf3c49223eacbd75f1d4ae9c83b326deb Fri Aug 26 08:57:01 UTC 2022 Andreas Gohr <andi@splitbrain.org> introduce sexplode() as a PHP8 safe explode()

We often have constructs like

list($foo, $bar) = explode(',', $input, 2);

In PHP8+ this will throw warnings when the explode returns fewer than 2
elements. Our code usually (always?) will anticipate missing elements so
the construct isn't really problematic.

The implementation here wraps the solution suggested at
https://stackoverflow.com/a/56971347 into a new utility function.

I anticipate that people might object to the function name. It was
chosen as a short form of "safe explode". This makes fixing the warning
easy by simply adding a single letter. I also find it slightly amusing
and would be open to change it to just sex() just for the fun of it.