Search
 
SCRIPT & CODE EXAMPLE
 

PHP

flatten a multi-dimensional array into a single array in php

//The array_flatten function will flatten a multi-dimensional array into a single level
$array = ['name' => 'Issac', 'languages' => ['PHP', 'Python']];
$array = array_flatten($array);
// ['Issac', 'PHP', 'Python'];
Comment

php flatten multidimensional array

<?php

$notFlat = [[1,2],[3,4]];
$flat = array_merge(...$notFlat);
var_dump($flat);
Comment

PREVIOUS NEXT
Code Example
Php :: if object or array in php 
Php :: php randon integer 4 digit 
Php :: get file name from url in php 
Php :: laravel where not 
Php :: PHP Simple HTML DOM 
Php :: laravel new date 
Php :: docker check php version 
Php :: wp create user programmatically 
Php :: if condition inside echo in php 
Php :: php jquery plus 1 day 
Php :: get the current date and time in php 
Php :: php expire session 
Php :: Delete an array in multidimensional array php 
Php :: remove cache from cpanle larael 
Php :: cron run 1 time 
Php :: how to delete php from win10 
Php :: create migration, controller, model and seeder laravel 
Php :: php file upload error 
Php :: mkdir permission denied php 
Php :: only display part of string php 
Php :: how to add an custom error to validater error in laravel 
Php :: laravel collection search by value 
Php :: get am pm 12 hour timee laravel 
Php :: reset password multipple database laravel 
Php :: laravel create text file 
Php :: php get current dir mac 
Php :: download laravel 8 zip 
Php :: get text field value in php 
Php :: laravel collection prepend 
Php :: laravel 8 route 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =