<?php $array = ['1' => 'A', '2' => null, '3' => 0]; foreach (['1', '2', '3', '4'] as $test) { var_export(isset($array[$test]) ? $array[$test] : '-'); echo " , "; var_export(key_exists($test, $array) ? $array[$test] : '-'); echo " , "; var_export(array_key_exists($test, $array) ? $array[$test] : '-'); echo " , "; var_export($array[$test] ?? '-'); echo "\n"; }
You have javascript disabled. You will not be able to edit any code.