Last Updated: February 25, 2016
·
641
· nickel715

check array keys in PHP

There are many ways to check if an array key exists or is empty.

This Table compares the different methods and there results

Table

Source

1 Response
Add your response

Realize that, in this case, isset and empty have function-like syntaxes, but they aren't really functions, different of array_key_exists, that is a syntactic abstraction for using isset or empty. Monads could be implemeted to avoid exceptions with nullables.

over 1 year ago ·

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.

Security insights from Cside