test - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of test.php
- <?php
- $orderby = '';
- $order = '';
- $temp_arr = [];
- $arr = array (
- 0 =>
- array (
- 'orderby' => 'title',
- 'order' => 'asc',
- ),
- 1 =>
- array (
- 'orderby' => 'name',
- 'order' => 'desc',
- ),
- 2 =>
- array (
- 'orderby' => 'ID',
- 'order' => 'asc',
- ),
- );
- foreach($arr as $item) {
- foreach( $item as $k => $v ) {
- if($k === 'orderby') {
- $orderby = $v;
- }
- if($k === 'order') {
- $order = $v;
- }
- $temp_arr[$orderby] = $order;
- }
- }
- var_dump($temp_arr);