3v4l.org

run code in 500+ PHP versions simultaneously
<?php function product_name_split($prod_name) { return preg_split( "/ \p{Pd} /u", strip_tags( html_entity_decode( $prod_name ) ), 2 ); } $tests = [ 'Tee-shirt - product color', 'Boxer Welbar - ligth grey', 'Longjohn Gari - marine stripe', 'En dash – green', 'Entity &#8211; blue', ]; foreach ($tests as $test) { echo var_export(product_name_split($test, true)) . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 13
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/TZPfi
function name:  (null)
number of ops:  15
compiled vars:  !0 = $tests, !1 = $test
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                       !0, <array>
   23     1      > FE_RESET_R                                           $3      !0, ->13
          2    > > FE_FETCH_R                                                   $3, !1, ->13
   24     3    >   INIT_FCALL                                                   'var_export'
          4        INIT_FCALL                                                   'product_name_split'
          5        SEND_VAR                                                     !1
          6        SEND_VAL                                                     <true>
          7        DO_FCALL                                          0  $4      
          8        SEND_VAR                                                     $4
          9        DO_ICALL                                             $5      
         10        CONCAT                                               ~6      $5, '%0A'
         11        ECHO                                                         ~6
   23    12      > JMP                                                          ->2
         13    >   FE_FREE                                                      $3
   25    14      > RETURN                                                       1

Function product_name_split:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TZPfi
function name:  product_name_split
number of ops:  14
compiled vars:  !0 = $prod_name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    4     1        INIT_FCALL                                                   'preg_split'
    5     2        SEND_VAL                                                     '%2F+%5Cp%7BPd%7D+%2Fu'
    6     3        INIT_FCALL                                                   'strip_tags'
    7     4        INIT_FCALL                                                   'html_entity_decode'
    8     5        SEND_VAR                                                     !0
    7     6        DO_ICALL                                             $1      
    8     7        SEND_VAR                                                     $1
    6     8        DO_ICALL                                             $2      
    8     9        SEND_VAR                                                     $2
   11    10        SEND_VAL                                                     2
    4    11        DO_ICALL                                             $3      
   11    12      > RETURN                                                       $3
   13    13*     > RETURN                                                       null

End of function product_name_split

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
127.99 ms | 484 KiB | 12 Q