I'm using it at a fresh start up. Having used node, internal Google frameworks, python, and dart previously, I would highly recommend PHP for new projects. Laravel is what makes it worth it imo.
$data = [
'more' => [
'complex' => ['my value']
]
];
if (array_key_exists('more', $data) && array_key_exists('complex', $data['more']) && array_key_exists(0, $data['more']['complex'])) {
echo $data['more']['complex'][0];
}
You can do this: echo Arr::get($data, 'more.complex.0');
Plus the bog standard php null coalescing operator "??" is pretty sweet. // fetch the value of $_GET['user'] and returns 'not passed'
// if username is not passed
$username = $_GET['username'] ?? 'not passed';
Just some little things off the top of my head. *Formatting.I do think better languages do it better, for example in Elixir I can extract multiple elements out of an object at the same time.
object = %{nested: ["my value"], other: "some element"}
%{nested: [first | _], other: other} = object
first now equals "my value" and other now equals "some element".PHP sucks because of the legacy it pulls with it that keeps it from being simple and elegant. It also fails pretty hard when you use it outside of it's niche, and a multi-purpose language > single purpose language.