3v4l.org

run code in 300+ PHP versions simultaneously
<?php $item['value'] = "1 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 != FALSE)){ $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 = 32
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 32
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 31
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 31
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/pkafa
function name:  (null)
number of ops:  35
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                                                  '1+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, ->32
         10    > > FE_FETCH_R                                               $13, !4, ->32
    7    11    >   INIT_FCALL                                               'strpos'
         12        SEND_VAR                                                 !1
         13        BOOL                                             ~14     !4
         14        SEND_VAL                                                 ~14
         15        DO_ICALL                                         $15     
         16      > JMPZ                                                     $15, ->31
    8    17    >   INIT_FCALL                                               'array_search'
         18        SEND_VAR                                                 !4
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $16     
         21        ASSIGN                                                   !5, $16
    9    22        ECHO                                                     !5
   10    23        INIT_FCALL                                               'strtr'
         24        SEND_VAR                                                 !1
         25        FETCH_DIM_R                                      ~18     !3, !5
         26        INIT_ARRAY                                       ~19     ~18, !4
         27        SEND_VAL                                                 ~19
         28        DO_ICALL                                         $20     
         29        ASSIGN                                                   !6, $20
   11    30        ASSIGN                                                   !1, !6
    6    31    > > JMP                                                      ->10
         32    >   FE_FREE                                                  $13
   14    33        ECHO                                                     !1
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.66 ms | 1396 KiB | 21 Q