3v4l.org

run code in 500+ PHP versions simultaneously
<?php $unresponsives4 = $unresponsives3 = $unresponsives2 = $unresponsives = [ [ "Customer", "172.52.46.75", "2022-04-01 16:20:45", "1817", "nxlog", "2328.02 Hours" ], [ "Customer", "172.25.89.45", "2022-04-01 16:20:45", "1817", "nxlog", "Undefined" ], [ "Customer", "172.19.10.94", "2022-04-01 16:20:45", "1817", "nxlog", "2324.02 Hours" ], [ "Customer", "172.19.10.94", "2022-04-01 16:20:45", "1817", "nxlog", "2322.02 Hours" ], [ "Customer", "172.19.10.94", "2022-04-01 16:20:45", "1817", "nxlog", "Undefined" ], ]; function compd1($a, $b) { $v1 = $a[5]; $v2 = $b[5]; if ('Undefined' === $v1) { $v1 = PHP_INT_MAX; } if ('Undefined' === $v2) { $v2 = PHP_INT_MAX; } return floatval($v2) <=> floatval($v1); } usort($unresponsives, 'compd1'); var_export($unresponsives); echo PHP_EOL . PHP_EOL; function compd2($a, $b) { return ('Undefined' === $b[5] ? PHP_INT_MAX : floatval($b[5])) <=> ('Undefined' === $a[5] ? PHP_INT_MAX : floatval($a[5])); } usort($unresponsives2, 'compd2'); var_export($unresponsives2); echo PHP_EOL . PHP_EOL; echo '---------------------------------------------------------------'; echo PHP_EOL . PHP_EOL; function compa1($a, $b) { $v1 = $a[5]; $v2 = $b[5]; if ('Undefined' === $v1) { $v1 = PHP_INT_MIN; } if ('Undefined' === $v2) { $v2 = PHP_INT_MIN; } return floatval($v1) <=> floatval($v2); } usort($unresponsives3, 'compa1'); var_export($unresponsives3); echo PHP_EOL . PHP_EOL; function compa2($a, $b) { return ('Undefined' === $a[5] ? PHP_INT_MIN : floatval($a[5])) <=> ('Undefined' === $b[5] ? PHP_INT_MIN : floatval($b[5])); } usort($unresponsives4, 'compa2'); var_export($unresponsives4);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Uoml6
function name:  (null)
number of ops:  38
compiled vars:  !0 = $unresponsives4, !1 = $unresponsives3, !2 = $unresponsives2, !3 = $unresponsives
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                               ~4      !3, <array>
          1        ASSIGN                                               ~5      !2, ~4
          2        ASSIGN                                               ~6      !1, ~5
          3        ASSIGN                                                       !0, ~6
   60     4        INIT_FCALL                                                   'usort'
          5        SEND_REF                                                     !3
          6        SEND_VAL                                                     'compd1'
          7        DO_ICALL                                                     
   62     8        INIT_FCALL                                                   'var_export'
          9        SEND_VAR                                                     !3
         10        DO_ICALL                                                     
   65    11        ECHO                                                         '%0A%0A'
   72    12        INIT_FCALL                                                   'usort'
         13        SEND_REF                                                     !2
         14        SEND_VAL                                                     'compd2'
         15        DO_ICALL                                                     
   74    16        INIT_FCALL                                                   'var_export'
         17        SEND_VAR                                                     !2
         18        DO_ICALL                                                     
   76    19        ECHO                                                         '%0A%0A'
   78    20        ECHO                                                         '---------------------------------------------------------------'
   80    21        ECHO                                                         '%0A%0A'
   96    22        INIT_FCALL                                                   'usort'
         23        SEND_REF                                                     !1
         24        SEND_VAL                                                     'compa1'
         25        DO_ICALL                                                     
   98    26        INIT_FCALL                                                   'var_export'
         27        SEND_VAR                                                     !1
         28        DO_ICALL                                                     
  100    29        ECHO                                                         '%0A%0A'
  107    30        INIT_FCALL                                                   'usort'
         31        SEND_REF                                                     !0
         32        SEND_VAL                                                     'compa2'
         33        DO_ICALL                                                     
  109    34        INIT_FCALL                                                   'var_export'
         35        SEND_VAR                                                     !0
         36        DO_ICALL                                                     
         37      > RETURN                                                       1

Function compd1:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
Branch analysis from position: 9
filename:       /in/Uoml6
function name:  compd1
number of ops:  17
compiled vars:  !0 = $a, !1 = $b, !2 = $v1, !3 = $v2
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   46     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   48     2        FETCH_DIM_R                                          ~4      !0, 5
          3        ASSIGN                                                       !2, ~4
   49     4        FETCH_DIM_R                                          ~6      !1, 5
          5        ASSIGN                                                       !3, ~6
   50     6        IS_IDENTICAL                                                 !2, 'Undefined'
          7      > JMPZ                                                         ~8, ->9
   51     8    >   ASSIGN                                                       !2, 9223372036854775807
   53     9    >   IS_IDENTICAL                                                 !3, 'Undefined'
         10      > JMPZ                                                         ~10, ->12
   54    11    >   ASSIGN                                                       !3, 9223372036854775807
   57    12    >   CAST                                              5  ~12     !3
         13        CAST                                              5  ~13     !2
         14        SPACESHIP                                            ~14     ~12, ~13
         15      > RETURN                                                       ~14
   58    16*     > RETURN                                                       null

End of function compd1

Function compd2:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
Branch analysis from position: 15
filename:       /in/Uoml6
function name:  compd2
number of ops:  21
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   67     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   69     2        FETCH_DIM_R                                          ~2      !1, 5
          3        IS_IDENTICAL                                                 ~2, 'Undefined'
          4      > JMPZ                                                         ~3, ->7
          5    >   QM_ASSIGN                                            ~4      9223372036854775807
          6      > JMP                                                          ->10
          7    >   FETCH_DIM_R                                          ~5      !1, 5
          8        CAST                                              5  ~6      ~5
          9        QM_ASSIGN                                            ~4      ~6
         10    >   FETCH_DIM_R                                          ~7      !0, 5
         11        IS_IDENTICAL                                                 ~7, 'Undefined'
         12      > JMPZ                                                         ~8, ->15
         13    >   QM_ASSIGN                                            ~9      9223372036854775807
         14      > JMP                                                          ->18
         15    >   FETCH_DIM_R                                          ~10     !0, 5
         16        CAST                                              5  ~11     ~10
         17        QM_ASSIGN                                            ~9      ~11
         18    >   SPACESHIP                                            ~12     ~4, ~9
         19      > RETURN                                                       ~12
   70    20*     > RETURN                                                       null

End of function compd2

Function compa1:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
Branch analysis from position: 9
filename:       /in/Uoml6
function name:  compa1
number of ops:  17
compiled vars:  !0 = $a, !1 = $b, !2 = $v1, !3 = $v2
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   82     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   84     2        FETCH_DIM_R                                          ~4      !0, 5
          3        ASSIGN                                                       !2, ~4
   85     4        FETCH_DIM_R                                          ~6      !1, 5
          5        ASSIGN                                                       !3, ~6
   86     6        IS_IDENTICAL                                                 !2, 'Undefined'
          7      > JMPZ                                                         ~8, ->9
   87     8    >   ASSIGN                                                       !2, -9223372036854775808
   89     9    >   IS_IDENTICAL                                                 !3, 'Undefined'
         10      > JMPZ                                                         ~10, ->12
   90    11    >   ASSIGN                                                       !3, -9223372036854775808
   93    12    >   CAST                                              5  ~12     !2
         13        CAST                                              5  ~13     !3
         14        SPACESHIP                                            ~14     ~12, ~13
         15      > RETURN                                                       ~14
   94    16*     > RETURN                                                       null

End of function compa1

Function compa2:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
Branch analysis from position: 15
filename:       /in/Uoml6
function name:  compa2
number of ops:  21
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  102     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
  104     2        FETCH_DIM_R                                          ~2      !0, 5
          3        IS_IDENTICAL                                                 ~2, 'Undefined'
          4      > JMPZ                                                         ~3, ->7
          5    >   QM_ASSIGN                                            ~4      -9223372036854775808
          6      > JMP                                                          ->10
          7    >   FETCH_DIM_R                                          ~5      !0, 5
          8        CAST                                              5  ~6      ~5
          9        QM_ASSIGN                                            ~4      ~6
         10    >   FETCH_DIM_R                                          ~7      !1, 5
         11        IS_IDENTICAL                                                 ~7, 'Undefined'
         12      > JMPZ                                                         ~8, ->15
         13    >   QM_ASSIGN                                            ~9      -9223372036854775808
         14      > JMP                                                          ->18
         15    >   FETCH_DIM_R                                          ~10     !1, 5
         16        CAST                                              5  ~11     ~10
         17        QM_ASSIGN                                            ~9      ~11
         18    >   SPACESHIP                                            ~12     ~4, ~9
         19      > RETURN                                                       ~12
  105    20*     > RETURN                                                       null

End of function compa2

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.96 ms | 2592 KiB | 15 Q