Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to remove keys in subarray php

print_r(deep_delete_keys($arr,'country'));

function deep_delete_keys($arr, $keys) {
    if (!is_array($keys)) $keys = array($keys);
    $filteredArr = array_diff_key( $arr, array_flip( $keys ) );
    foreach ($filteredArr as &$val) {
        if (is_array($val)) {
            $val = deep_delete_keys($val, $keys);
        }
    }
    return $filteredArr;
}
Comment

PREVIOUS NEXT
Code Example
Php :: php rsort retain keys 
Php :: Array to XML Conversion using PHP 
Php :: unique check with multiple columns laravel validation 
Php :: do i need to install php after xampp 
Php :: php check if text is blank 
Php :: time left laravel seconds 
Php :: laravel cache remember 
Php :: can I change my ip adress with python 
Php :: php string left 10 characters 
Php :: codeigniter abort 404 
Php :: name of today php 
Php :: symfony get path to route 
Php :: searchable dropdown laravel blade 
Php :: wp query meta in array 
Php :: check if session is started 
Php :: php set environment variable 
Php :: guzzle Request with POST files 
Php :: php fetch mysql result as variable 
Php :: Group by not working - Laravel 
Php :: laravel Class "PDO" not found 
Php :: laravel use variable inside callback function 
Php :: php http authentication 
Php :: lDownload multiple files as a zip-file using php 
Php :: composer remove phpmailer 
Php :: display image from mysqli database 
Php :: foreach date php 
Php :: root composer.json requires php ^7.3 but your php version (8.0.3) does not satisfy that requirement. 
Php :: laravel faker example 
Php :: is replace case sensitive php 
Php :: query relationships laravel and select some columns 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =