3v4l.org

run code in 300+ PHP versions simultaneously
<?php $item['value'] = "1kilograms teaspoon of fish sauce"; $instruction = strtolower($item['value']); $searchArray = array("grams", "kilograms", "ounces", "tablespoon", "teaspoon"); $swapArray = array("g", "kg", "oz", "tbsp", "tsp"); foreach($searchArray as $search){ if(strpos($instruction, $search)){ $key = array_search($search, $searchArray); echo $key; $instructionTmp = strtr($instruction, array($search => $swapArray[$key])); $instruction = $instructionTmp; } } echo $instruction;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 31
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 31
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 30
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 30
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/ltmve
function name:  (null)
number of ops:  34
compiled vars:  !0 = $item, !1 = $instruction, !2 = $searchArray, !3 = $swapArray, !4 = $search, !5 = $key, !6 = $instructionTmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN_DIM                                               !0, 'value'
          1        OP_DATA                                                  '1kilograms+teaspoon+of+fish+sauce'
    3     2        INIT_FCALL                                               'strtolower'
          3        FETCH_DIM_R                                      ~8      !0, 'value'
          4        SEND_VAL                                                 ~8
          5        DO_ICALL                                         $9      
          6        ASSIGN                                                   !1, $9
    4     7        ASSIGN                                                   !2, <array>
    5     8        ASSIGN                                                   !3, <array>
    6     9      > FE_RESET_R                                       $13     !2, ->31
         10    > > FE_FETCH_R                                               $13, !4, ->31
    7    11    >   INIT_FCALL                                               'strpos'
         12        SEND_VAR                                                 !1
         13        SEND_VAR                                                 !4
         14        DO_ICALL                                         $14     
         15      > JMPZ                                                     $14, ->30
    8    16    >   INIT_FCALL                                               'array_search'
         17        SEND_VAR                                                 !4
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                         $15     
         20        ASSIGN                                                   !5, $15
    9    21        ECHO                                                     !5
   10    22        INIT_FCALL                                               'strtr'
         23        SEND_VAR                                                 !1
         24        FETCH_DIM_R                                      ~17     !3, !5
         25        INIT_ARRAY                                       ~18     ~17, !4
         26        SEND_VAL                                                 ~18
         27        DO_ICALL                                         $19     
         28        ASSIGN                                                   !6, $19
   11    29        ASSIGN                                                   !1, !6
    6    30    > > JMP                                                      ->10
         31    >   FE_FREE                                                  $13
   14    32        ECHO                                                     !1
         33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.73 ms | 1396 KiB | 21 Q