3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $var1 = 123; $var2 = '456A'; $var3 = 789; echo to_number($var1) . "\n"; echo to_number($var2) . "\n"; echo to_number($var3) . "\n"; echo $var2 + 0, "\n"; # convert var to number function to_number($var) { return 0 + $var; }
based on oEKPD
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/cmNve
function name:  (null)
number of ops:  23
compiled vars:  !0 = $var1, !1 = $var2, !2 = $var3
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   4     0  E >   ASSIGN                                                   !0, 123
   5     1        ASSIGN                                                   !1, '456A'
   6     2        ASSIGN                                                   !2, 789
   8     3        INIT_FCALL_BY_NAME                                       'to_number'
         4        SEND_VAR_EX                                              !0
         5        DO_FCALL                                      0  $6      
         6        CONCAT                                           ~7      $6, '%0A'
         7        ECHO                                                     ~7
   9     8        INIT_FCALL_BY_NAME                                       'to_number'
         9        SEND_VAR_EX                                              !1
        10        DO_FCALL                                      0  $8      
  10    11        CONCAT                                           ~9      $8, '%0A'
        12        ECHO                                                     ~9
  11    13        INIT_FCALL_BY_NAME                                       'to_number'
        14        SEND_VAR_EX                                              !2
        15        DO_FCALL                                      0  $10     
        16        CONCAT                                           ~11     $10, '%0A'
        17        ECHO                                                     ~11
  14    18        ADD                                              ~12     !1, 0
        19        ECHO                                                     ~12
        20        ECHO                                                     '%0A'
  17    21        NOP                                                      
  20    22      > RETURN                                                   1

Function to_number:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/cmNve
function name:  to_number
number of ops:  4
compiled vars:  !0 = $var
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  17     0  E >   RECV                                             !0      
  19     1        ADD                                              ~1      0, !0
         2      > RETURN                                                   ~1
  20     3*     > RETURN                                                   null

End of function to_number

Generated using Vulcan Logic Dumper, using php 7.2.0