Search
 
SCRIPT & CODE EXAMPLE
 

PHP

copy php array to another

$arr1 = ['a'=>1, 'b'=>2, 'c'=>3];
$arr2 = $arr1;

unset($arr2['a'];
print_r($arr1);
//['b'=>2, 'c'=>3]
// ------- OR -------
$arr2 = clone $arr1;

unset($arr2['a'];
print_r($arr1);
//['a'=>1, 'b'=>2, 'c'=>3]
Comment

PREVIOUS NEXT
Code Example
Php :: last_insert_id() php 
Php :: how to trim string in laravel 
Php :: has password argon2i 
Php :: a php session was created by a session_start() 
Php :: install php pdo mysql PHP5.6 alpine-apache 
Php :: php arrow function 
Php :: laravel cors enable 
Php :: Laravel 8 Pagination Ui Problem 
Php :: laravel How to capture output in a file from php artisan test 
Php :: how to sort with array and after print by for loop in php 
Php :: gettype() function in PHP 
Php :: send json reponse php 
Php :: country code validation in laravel 
Php :: php url parameters 
Php :: php clear post data 
Php :: php null 
Php :: author page url from the current post 
Php :: php array access by key 
Php :: php pdo sql server connect 
Php :: IlluminateContractsAuthAuthenticatable, AppModelsUser given, called in 
Php :: pmxi_gallery_image 
Php :: php difference between two dates in seconds 
Php :: refresh laravel model 
Php :: wordpress debug mode 
Php :: livewire call another component 
Php :: contact form 7 remove br 
Php :: laravel make factory 
Php :: php include once inside a function? 
Php :: laravel max length format 
Php :: laravel tinker insert db record 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =