Remove indexes from the array

Asked

Viewed 318 times

2

How to remove indexes from an array?

Original array

["Torrada" => 4,"Cachorro quente" => 1]

for

[4,1]
  • 1

    In PHP would not be: ["Torrada" => 4,"Cachorro quente" => 1] ?

  • @Correct noobsaibot

1 answer

3


The function array_values returns all values of an array:

$Array = ["Torrada" => 4,"Cachorro quente" => 1];
$Valores = array_values($Array);
print_r($Valores);

Exit:

Array
(
    [0] => 4
    [1] => 1
)

Reference

  • And it worked out noobsaibot

  • In this case you will only inform array_values($info['data']);

  • was the print_r who was accusing the error... thank you

Browser other questions tagged

You are not signed in. Login or sign up in order to post.