3v4l.org

run code in 300+ PHP versions simultaneously
<?php function happy($num){ $digs = (string) $num; $sum = 0; foreach($digs->explode() as $dig){ $sum == $dig; } return $sum; } echo happy(31);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YfOEl
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'happy'
          1        SEND_VAL                                                 31
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function happy:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/YfOEl
function name:  happy
number of ops:  14
compiled vars:  !0 = $num, !1 = $digs, !2 = $sum, !3 = $dig
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        CAST                                          6  ~4      !0
          2        ASSIGN                                                   !1, ~4
    5     3        ASSIGN                                                   !2, 0
    6     4        INIT_METHOD_CALL                                         !1, 'explode'
          5        DO_FCALL                                      0  $7      
          6      > FE_RESET_R                                       $8      $7, ->11
          7    > > FE_FETCH_R                                               $8, !3, ->11
    7     8    >   IS_EQUAL                                         ~9      !2, !3
          9        FREE                                                     ~9
    6    10      > JMP                                                      ->7
         11    >   FE_FREE                                                  $8
    9    12      > RETURN                                                   !2
   10    13*     > RETURN                                                   null

End of function happy

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.15 ms | 1402 KiB | 14 Q