3v4l.org

run code in 300+ PHP versions simultaneously
<?php function a($value) { return is_nan($value) ? null : $value; } function b($value) { return is_float($value) && is_nan($value) ? null : $value; } function meh($value) { var_dump(a($value) === b($value)); } foreach (array(0, NAN, "asdf", 2.4) as $value) { meh($value); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 1, Position 2 = 6
Branch analysis from position: 1
2 jumps found. (Code = 78) Position 1 = 2, Position 2 = 6
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 1
Branch analysis from position: 1
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/4F244
function name:  (null)
number of ops:  8
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E > > FE_RESET_R                                       $1      <array>, ->6
          1    > > FE_FETCH_R                                               $1, !0, ->6
   16     2    >   INIT_FCALL                                               'meh'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0          
   15     5      > JMP                                                      ->1
          6    >   FE_FREE                                                  $1
   17     7      > RETURN                                                   1

Function a:
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 = 8
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4F244
function name:  a
number of ops:  10
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'is_nan'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > JMPZ                                                     $1, ->7
          5    >   QM_ASSIGN                                        ~2      null
          6      > JMP                                                      ->8
          7    >   QM_ASSIGN                                        ~2      !0
          8    > > RETURN                                                   ~2
    5     9*     > RETURN                                                   null

End of function a

Function b:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/4F244
function name:  b
number of ops:  13
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        TYPE_CHECK                                   32  ~1      !0
          2      > JMPZ_EX                                          ~1      ~1, ->7
          3    >   INIT_FCALL                                               'is_nan'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        BOOL                                             ~1      $2
          7    > > JMPZ                                                     ~1, ->10
          8    >   QM_ASSIGN                                        ~3      null
          9      > JMP                                                      ->11
         10    >   QM_ASSIGN                                        ~3      !0
         11    > > RETURN                                                   ~3
    9    12*     > RETURN                                                   null

End of function b

Function meh:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4F244
function name:  meh
number of ops:  12
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'a'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $1      
          5        INIT_FCALL                                               'b'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0  $2      
          8        IS_IDENTICAL                                     ~3      $1, $2
          9        SEND_VAL                                                 ~3
         10        DO_ICALL                                                 
   13    11      > RETURN                                                   null

End of function meh

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.14 ms | 1403 KiB | 20 Q