In order to check if an input field is empty or has any value, will the following both methods work in same way? Or is any of them better than other?
if ($options['url']) {
..
}
Or
if ( isset ($options['url']) && ($options['url']!="") ) {
..
}
Without checking with
isset()you will get at least a notice message if$optionsis not an array or the indexurldoes not exist. Soisset()should be used.You could also use
Empty() checks for any false value (like an empty string, undefined, etc…).