Answers for "php array to string with keys multidimensional"

PHP
2

convert multidimensional array to single array php

$singleArray = []; 
foreach ($parentArray as $childArray) 
{ 
    foreach ($childArray as $value) 
    { 
    $singleArray[] = $value; 
    } 
}
Posted by: Guest on October-13-2020
0

php access multidimensional array by string

function get_multi($arr, $str) {
    foreach (explode('.', $str) as $key) {
        if (!array_key_exists($key, $arr)) {
            return NULL; 
        }
        $arr = $arr[$key];
    }

    return $arr;
}
Posted by: Guest on November-24-2021

Code answers related to "php array to string with keys multidimensional"

Browse Popular Code Answers by Language