You know how to do, just don’t know how to see the result. The function sort()
realize what you want upon your own array that you pass. Then you just print the array again after going through the function everything will work out. You just can’t have the function return printed because according to the documentation (has to read it to learn, alias has to read everything to program, to use new sites, etc., read is the secret to evolve), it returns a booliano whether it worked or failed. She returns no other array ordained.
<?php
$resultado = array();
for ($i = 0; $i <= 5; $i++) array_push($resultado, rand(1, 60));
print_r($resultado);
sort($resultado);
print_r($resultado);
Behold working in the ideone. And in the repl it.. Also put on the Github for future reference.
Perfect!!! Something so simple and I didn’t use the correct order. Thank you very much.
– Bruno Manso
Take a look at [tour]. You can accept an answer if it solved your problem. You can vote on every post on the site as well. Did any help you more? You need something to be improved?
– Maniero
Just complementing... Beyond the
sort
, there are many other options, each one specific to a case. Documentation: Ordaining– rbz