3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array =Array ( '0' => 'apple', '1' => 'Pear', '2' => 'orange', '3' => 'mango', '4' => '[banana]', '5' => 'Cantaloupe', '6' => 'Peach', ); $value_w_bracket = key(preg_grep('/\[\w+\]/i', $array)); $intermediate[0] = $array[$value_w_bracket]; unset($array[$value_w_bracket]); natcasesort($array); $final = array_merge($intermediate,$array); print_r($final); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KodUI
function name:  (null)
number of ops:  25
compiled vars:  !0 = $array, !1 = $value_w_bracket, !2 = $intermediate, !3 = $final
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   12     1        INIT_FCALL                                               'key'
          2        INIT_FCALL                                               'preg_grep'
          3        SEND_VAL                                                 '%2F%5C%5B%5Cw%2B%5C%5D%2Fi'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        SEND_VAR                                                 $5
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !1, $6
   13     9        FETCH_DIM_R                                      ~9      !0, !1
         10        ASSIGN_DIM                                               !2, 0
         11        OP_DATA                                                  ~9
   14    12        UNSET_DIM                                                !0, !1
   15    13        INIT_FCALL                                               'natcasesort'
         14        SEND_REF                                                 !0
         15        DO_ICALL                                                 
   16    16        INIT_FCALL                                               'array_merge'
         17        SEND_VAR                                                 !2
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $11     
         20        ASSIGN                                                   !3, $11
   17    21        INIT_FCALL                                               'print_r'
         22        SEND_VAR                                                 !3
         23        DO_ICALL                                                 
   20    24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.88 ms | 1001 KiB | 18 Q