Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php move in array

$array = [
    0 => 'a', 
    1 => 'c', 
    2 => 'd', 
    3 => 'b', 
    4 => 'e',
];

function moveElement(&$array, $a, $b) {
    $out = array_splice($array, $a, 1);
    array_splice($array, $b, 0, $out);
}

moveElement($array, 3, 1);
Comment

PREVIOUS NEXT
Code Example
Php :: bootstrap autocomplete example laravel 
Php :: wp wc php if not is single product page 
Php :: how to close login route in laravel 
Php :: codeigniter number format function 
Php :: what is php artisan 
Php :: is search page wordpress dev 
Php :: echo placeholder image if post thumbnail not found 
Php :: eloquent multiple orwhere 
Php :: php pagination ellipsis 
Php :: eloquent firstorcreate 
Php :: laravel allow all fillable 
Php :: php command line check syntax errors 
Php :: map array php 
Php :: run new oroject laravel with idff port 
Php :: Pure Intersection Types - PHP 8.1 
Php :: string put inside tag string php 
Php :: php get parent url from script location 
Php :: numberformater php format to k and m 
Php :: laravel 8 model filter 
Php :: phpmyadmin mysql execution time 
Php :: laravel request protected prop 
Php :: debugbar:clear in laravel 
Php :: codeigniter 3 session not working after some time 
Php :: check if any field update laravel 
Php :: laravel use npm package 
Php :: php = 
Php :: laravel verify email custom url 
Php :: install multiple php versions windows 
Php :: laravel crud application 
Php :: where is view folder in laravel 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =