3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pin1='1234'; $pin2='1234-5678'; $pin3='1234-5678-0000-5566-8900-5600-4555-1330-2334'; function countPin($pin) { return substr_count($pin, '-') + 1; } echo 'Pin 1 heeft ' . countPin($pin1) . ' code(s), '; echo 'pin 2 heeft ' . countPin($pin2) . ' code(s) en '; echo 'pin 3 heeft ' . countPin($pin3) . ' code(s).';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PTLfI
function name:  (null)
number of ops:  22
compiled vars:  !0 = $pin1, !1 = $pin2, !2 = $pin3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '1234'
    4     1        ASSIGN                                                   !1, '1234-5678'
    5     2        ASSIGN                                                   !2, '1234-5678-0000-5566-8900-5600-4555-1330-2334'
   11     3        INIT_FCALL                                               'countpin'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $6      
          6        CONCAT                                           ~7      'Pin+1+heeft+', $6
          7        CONCAT                                           ~8      ~7, '+code%28s%29%2C+'
          8        ECHO                                                     ~8
   12     9        INIT_FCALL                                               'countpin'
         10        SEND_VAR                                                 !1
         11        DO_FCALL                                      0  $9      
         12        CONCAT                                           ~10     'pin+2+heeft+', $9
         13        CONCAT                                           ~11     ~10, '+code%28s%29+en+'
         14        ECHO                                                     ~11
   13    15        INIT_FCALL                                               'countpin'
         16        SEND_VAR                                                 !2
         17        DO_FCALL                                      0  $12     
         18        CONCAT                                           ~13     'pin+3+heeft+', $12
         19        CONCAT                                           ~14     ~13, '+code%28s%29.'
         20        ECHO                                                     ~14
         21      > RETURN                                                   1

Function countpin:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PTLfI
function name:  countPin
number of ops:  8
compiled vars:  !0 = $pin
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        INIT_FCALL                                               'substr_count'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '-'
          4        DO_ICALL                                         $1      
          5        ADD                                              ~2      $1, 1
          6      > RETURN                                                   ~2
    9     7*     > RETURN                                                   null

End of function countpin

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.21 ms | 1448 KiB | 17 Q