Skip to content
Advertisement

How i can make php sort by value name [closed]

i want to make which one is “live” at “status” case inside json begin from first.

“finish” second

“soon” 3th. and “false” is last in foreach php.

i use some code from “real_time” but now i want from “status” case. could you please help me.

Here is my json file

JavaScript

Advertisement

Answer

You can use the usort function for comparing the orders but the boolean needs to be converted in the comparison first. As for your criteria I have converted only for false value in the function.

JavaScript

Run Code Here

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement