3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ["string|||mfasdfhadskjfahsldfhcadkasldhfaf", "apple|||2345hrquwfiqfh4fhlqwu4f", "orange|||0erjoerhtqothcro"]; var_export(preg_replace('~\|.*~', '', $array)); echo "\n----\n"; foreach ($array as &$value) { $value = strstr($value, '|', true); } var_export($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
2 jumps found. (Code = 126) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/toe5e
function name:  (null)
number of ops:  24
compiled vars:  !0 = $array, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        INIT_FCALL                                               'var_export'
          2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAL                                                 '%7E%5C%7C.%2A%7E'
          4        SEND_VAL                                                 ''
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7        SEND_VAR                                                 $3
          8        DO_ICALL                                                 
    5     9        ECHO                                                     '%0A----%0A'
    7    10      > FE_RESET_RW                                      $5      !0, ->19
         11    > > FE_FETCH_RW                                              $5, !1, ->19
    8    12    >   INIT_FCALL                                               'strstr'
         13        SEND_VAR                                                 !1
         14        SEND_VAL                                                 '%7C'
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $6      
         17        ASSIGN                                                   !1, $6
    7    18      > JMP                                                      ->11
         19    >   FE_FREE                                                  $5
   10    20        INIT_FCALL                                               'var_export'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.66 ms | 1406 KiB | 19 Q