Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting indexed array to normal or simple array

I am trying to convert indexed array to normal array. Basically what get is:

Array ( [0] => 14 [1] => 19 [2] => 20 )

And I need is:

Array(14,19,20);

I tried over Google but not information found. I think this kind of function isn't available in PHP, is there any? please let me know!

Thanks, Asif

like image 456
Capripio Avatar asked Jul 31 '13 20:07

Capripio


1 Answers

You're chasing shadows:
Both of the arrays you've shown are equal.

There is no such thing as an unindexed array in PHP.

But if you really want to be sure, use $newArray = array_values($array)

like image 125
MightyPork Avatar answered Sep 20 '22 06:09

MightyPork