Stacking a variable in reverse in PHP -


I have a loop that spits the values ​​and it is inserted into the string:

 < Code> $ all_values ​​= ""; While loop {$ value = "..."; $ All_values ​​= $ value ""; }  

Output: 1,3,8,2,10 ...

The easiest way to output the same thing, but the number in reverse is so That example will come out like ... 10,2,8,3,1

Put everything in an array and then join it, vice versa:

  $ all_values ​​= array (); While loop {$ value = "..."; $ All_values ​​[] = $ value; } $ All_values ​​= implode (',', array_reverse ($ all_values));  

It is even more efficient at millions of values.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -