What are some common PHP built-in functions you have to google even though you use them constantly?
Top 100 PHP functions you should know
10 weird operators in PHP
The wrapper for all PHP internal (built-in) array functions and easy array manipulation library on steroids in an object-oriented way.
The wrapper for all PHP internal (built-in) array functions and easy array manipulation library on steroids in an object-oriented way.
Aren't steroids actually bad? :-)
Neat effort, but I need to very clearly point out that reference semantics for objects make very poor value objects and DTOs (which collections typically are used for).
I appreciate this is why the immutable versions exist, but one has to ask themselves how far they want to inconvenience themselves in order to say "my arrays are objects".
For example, I want to question the promise of "easy array manipulation" by asking how do I take immutable array $a and get a copy $b with this manipulation:
$b = $a; $b['foo']['bar']['baz'] = 123;
I'd like to question the author what is really the big win of typing this:
A::create([1, 2, 3])->foo();
Instead of this:
A::foo([1, 2, 3]);
I realize the above is shorter when you call lots of methods on the resulting object, but that shortness is offset by immense amount of complexity that should compensate for the fact objects don't have pass-by-value semantics as normal arrays do.
You'll also have to round-trip PHP arrays to your arrays and back a lot in practice, because most APIs use PHP arrays.
More on reddit.comVideos
Curious if any of you are constantly looking up things you use all the time?
For me - it is determining if a string contains a word. I am used to php 7 and constantly am googling "how to determine if string contains word"
if (strpos($haystack, $needle) !== false) {
echo 'true';
}
Or also I constantly confuse in_array with array_contains or array_includes which do not exist