Answers for "array keys get php"

PHP
1

php get object keys

<?php

class foo {
    private $a;
    public $b = 1;
    public $c;
    private $d;
    static $e;
   
    public function test() {
        var_dump(get_object_vars($this));
    }
}

$test = new foo;
var_dump(get_object_vars($test));

$test->test();

?>
Posted by: Guest on June-08-2021
5

get key of array element php

$people = array(
  2 => array(
    'name' => 'John',
    'fav_color' => 'green'
  ),
  5=> array(
    'name' => 'Samuel',
    'fav_color' => 'blue'
  ));
$found_key = array_search('blue', array_column($people, 'fav_color'));
Posted by: Guest on May-18-2020
0

get array key php

// The easiest way

var_dump(json_decode(json_encode($value), true));
Posted by: Guest on November-15-2021

Browse Popular Code Answers by Language