3v4l.org

run code in 300+ PHP versions simultaneously
<?php // r() simply returns a reference to a given variable. function &r(&$v){return $v;} // Here, we have a scalar $a on which settype() fails to operate if // parentheses are involved. print "Scalar demonstration:\n"; $a = 1; // First with parentheses, then without. // v v settype( ( r($a) ) , "boolean"); var_dump($a); settype( r($a) , "boolean"); var_dump($a); // ^ ^ // Here is a similar situation where array_pop() fails to operate upon a // reference to an array if parentheses are involved. print "\nArray demonstration:\n"; $b = array("c"); // First with parentheses, then without. // v v array_pop( ( r($b) ) ); print_r($b); array_pop( r($b) ); print_r($b); // ^ ^
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9QqBr
function name:  (null)
number of ops:  43
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ECHO                                                     'Scalar+demonstration%3A%0A'
    9     1        ASSIGN                                                   !0, 1
   13     2        INIT_FCALL                                               'settype'
          3        INIT_FCALL                                               'r'
          4        SEND_REF                                                 !0
          5        DO_FCALL                                      0  $3      
          6        SEND_VAR_NO_REF                               0          $3
          7        SEND_VAL                                                 'boolean'
          8        DO_ICALL                                                 
          9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
   14    12        INIT_FCALL                                               'settype'
         13        INIT_FCALL                                               'r'
         14        SEND_REF                                                 !0
         15        DO_FCALL                                      0  $6      
         16        SEND_VAR_NO_REF                               0          $6
         17        SEND_VAL                                                 'boolean'
         18        DO_ICALL                                                 
         19        INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                                 
   20    22        ECHO                                                     '%0AArray+demonstration%3A%0A'
   21    23        ASSIGN                                                   !1, <array>
   25    24        INIT_FCALL                                               'array_pop'
         25        INIT_FCALL                                               'r'
         26        SEND_REF                                                 !1
         27        DO_FCALL                                      0  $10     
         28        SEND_VAR_NO_REF                               0          $10
         29        DO_ICALL                                                 
         30        INIT_FCALL                                               'print_r'
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                                 
   26    33        INIT_FCALL                                               'array_pop'
         34        INIT_FCALL                                               'r'
         35        SEND_REF                                                 !1
         36        DO_FCALL                                      0  $13     
         37        SEND_VAR_NO_REF                               0          $13
         38        DO_ICALL                                                 
         39        INIT_FCALL                                               'print_r'
         40        SEND_VAR                                                 !1
         41        DO_ICALL                                                 
   27    42      > RETURN                                                   1

Function r:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/9QqBr
function name:  r
number of ops:  3
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1      > RETURN_BY_REF                                            !0
          2*     > RETURN_BY_REF                                            null

End of function r

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.89 ms | 1403 KiB | 25 Q