3v4l.org

run code in 300+ PHP versions simultaneously
<?php class X { private $y = null; public function __construct($y=null) { $this->y = (int)$y; } } function evilSearch($obj, $p=-2147483648, $q=2147483647, $max = 32, $c = 0) { if($c>$max) { return null; } $class = get_class($obj); $r = (int)(($p+$q)/2); $z = new $class($r); if($z>$obj) { return evilSearch($obj, $p, $r, $max, $c+1); } if($z<$obj) { return evilSearch($obj, $r, $q, $max, $c+1); } return $r; } echo('<pre>'); $test = new X(mt_rand()); var_dump(evilSearch($test), $test);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PDVFC
function name:  (null)
number of ops:  15
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   ECHO                                                     '%3Cpre%3E'
   33     1        NEW                                              $1      'X'
          2        INIT_FCALL                                               'mt_rand'
          3        DO_ICALL                                         $2      
          4        SEND_VAR_NO_REF_EX                                       $2
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $1
   34     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'evilsearch'
          9        SEND_VAR                                                 !0
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR                                                 $5
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function evilsearch:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 30
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 41
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PDVFC
function name:  evilSearch
number of ops:  43
compiled vars:  !0 = $obj, !1 = $p, !2 = $q, !3 = $max, !4 = $c, !5 = $class, !6 = $r, !7 = $z
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      -2147483648
          2        RECV_INIT                                        !2      2147483647
          3        RECV_INIT                                        !3      32
          4        RECV_INIT                                        !4      0
   15     5        IS_SMALLER                                               !3, !4
          6      > JMPZ                                                     ~8, ->8
   17     7    > > RETURN                                                   null
   19     8    >   GET_CLASS                                        ~9      !0
          9        ASSIGN                                                   !5, ~9
   20    10        ADD                                              ~11     !1, !2
         11        DIV                                              ~12     ~11, 2
         12        CAST                                          4  ~13     ~12
         13        ASSIGN                                                   !6, ~13
   21    14        FETCH_CLASS                                   0  $15     !5
         15        NEW                                              $16     $15
         16        SEND_VAR_EX                                              !6
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !7, $16
   22    19        IS_SMALLER                                               !0, !7
         20      > JMPZ                                                     ~19, ->30
   24    21    >   INIT_FCALL_BY_NAME                                       'evilSearch'
         22        SEND_VAR_EX                                              !0
         23        SEND_VAR_EX                                              !1
         24        SEND_VAR_EX                                              !6
         25        SEND_VAR_EX                                              !3
         26        ADD                                              ~20     !4, 1
         27        SEND_VAL_EX                                              ~20
         28        DO_FCALL                                      0  $21     
         29      > RETURN                                                   $21
   26    30    >   IS_SMALLER                                               !7, !0
         31      > JMPZ                                                     ~22, ->41
   28    32    >   INIT_FCALL_BY_NAME                                       'evilSearch'
         33        SEND_VAR_EX                                              !0
         34        SEND_VAR_EX                                              !6
         35        SEND_VAR_EX                                              !2
         36        SEND_VAR_EX                                              !3
         37        ADD                                              ~23     !4, 1
         38        SEND_VAL_EX                                              ~23
         39        DO_FCALL                                      0  $24     
         40      > RETURN                                                   $24
   30    41    > > RETURN                                                   !6
   31    42*     > RETURN                                                   null

End of function evilsearch

Class X:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PDVFC
function name:  __construct
number of ops:  5
compiled vars:  !0 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV_INIT                                        !0      null
    9     1        CAST                                          4  ~2      !0
          2        ASSIGN_OBJ                                               'y'
          3        OP_DATA                                                  ~2
   10     4      > RETURN                                                   null

End of function __construct

End of class X.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
184.39 ms | 1407 KiB | 18 Q