I have the following code which unnecessarily takes up 2 lines:
<?php
$items = get_my_items();
$item4 = $items[4];
// get_my_items()[4] # invalid code
?>
I'm not a beginner but this small thing is nerving whole the time... Any suggestions?
It's called array dereferencing. And it's available as of PHP 5.4. If you want it, upgrade your PHP.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With