[Solved] check value if null return 0 otherwise return the value
If you are sure for getting an integer for your $value[‘status’] you can cast it to integer, it would be shorter: // in case of null, casting will return 0 $status = $STATUSES[(int)$value[‘status’]]; 0 solved check value if null return 0 otherwise return the value