3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "Course_13_Laravel_Batch_15_Day_22"; $dim = explode("_", $string); $str = ""; foreach($dim as $item){ if(is_numeric( $item)){ $str = $str."-".substr($item, 0, 2); }else{ $str = $str."-".substr($item, 0, 1); } } $str = substr($str,1); echo $str;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 31
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 31
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 22
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/CWbqC
function name:  (null)
number of ops:  39
compiled vars:  !0 = $string, !1 = $dim, !2 = $str, !3 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Course_13_Laravel_Batch_15_Day_22'
    4     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '_'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
    5     6        ASSIGN                                                   !2, ''
    6     7      > FE_RESET_R                                       $8      !1, ->31
          8    > > FE_FETCH_R                                               $8, !3, ->31
    7     9    >   INIT_FCALL                                               'is_numeric'
         10        SEND_VAR                                                 !3
         11        DO_ICALL                                         $9      
         12      > JMPZ                                                     $9, ->22
    8    13    >   CONCAT                                           ~10     !2, '-'
         14        INIT_FCALL                                               'substr'
         15        SEND_VAR                                                 !3
         16        SEND_VAL                                                 0
         17        SEND_VAL                                                 2
         18        DO_ICALL                                         $11     
         19        CONCAT                                           ~12     ~10, $11
         20        ASSIGN                                                   !2, ~12
    7    21      > JMP                                                      ->30
   11    22    >   CONCAT                                           ~14     !2, '-'
         23        INIT_FCALL                                               'substr'
         24        SEND_VAR                                                 !3
         25        SEND_VAL                                                 0
         26        SEND_VAL                                                 1
         27        DO_ICALL                                         $15     
         28        CONCAT                                           ~16     ~14, $15
         29        ASSIGN                                                   !2, ~16
    6    30    > > JMP                                                      ->8
         31    >   FE_FREE                                                  $8
   14    32        INIT_FCALL                                               'substr'
         33        SEND_VAR                                                 !2
         34        SEND_VAL                                                 1
         35        DO_ICALL                                         $18     
         36        ASSIGN                                                   !2, $18
   15    37        ECHO                                                     !2
   16    38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.4 ms | 1010 KiB | 17 Q