Chrome Extension

Get values array by key name using array_column() PHP

You can get an array of values by key name from an associative array using the array_column() function PHP
<?php
    $employees = array(
        array(
            'emp_name' => 'Rick Grimes',
            'designation' => 'developer'
        ),
        array(
            'emp_name' => 'John Wick',
            'designation' => 'manager'
        )
    );

    $designations = array_column($employees, 'designation');
    print_r($designations);
?>
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool

Search Index Data (The code snippet can also be found with below search text)

array_column() PHP
Was this helpful?
0 Comments
Join Devsheet Ask a Question