php check if json key exists

PHOTO EMBED

Fri Apr 29 2022 06:28:45 GMT+0000 (Coordinated Universal Time)

Saved by @pakainfo

<?php
$search_array = array('first' => 1, 'second' => 4);
if (array_key_exists('first', $search_array)) {
    echo "The 'first' element is in the array";
}
?>


if( isset( $mydata['user_id'] ) ){
// do something
}
content_copyCOPY

Solutions on pakainfo.com for how to check if key is present in json in php by the best coders in the world.

https://www.pakainfo.com/php-check-if-json-key-exists/