How to order “zebra” array so each key has an alternate value (either 1, 0)
问题 If you have this PHP array: $args = array( 'a' => array( 'zebra' => 1, ), 'b' => array( 'zebra' => 0, ), 'c' => array( 'zebra' => 0, ), 'd' => array( 'zebra' => 0, ), 'e' => array( 'zebra' => 1, ), ); Is there a way to algorithmically change the order of this array by the "zebra" key value, but instead of being "incremental" (0,0,0,1,1), they would alternate (0,1,0,1,0). So using the example above, the desired finished array will look like this: $ordered_args = array( 'b' => array( 'zebra' =>