3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * Get Full Filter Name from Abbreviation */ function getFilterName ($filterAbbreviation) { $filters = array( "R" => "Restuarant", "B" => "Bar", "S" => "Store", "L" => "Lodging", "Q" => "Recreation", "G" => "Gas Station", "E" => "Entertainment", "C" => "Club" ); return $filters[$filterAbbreviation]; } /* * Parse Filterstring */ function parseFilterString($filterString) { $returnVal = ""; $filterLetters = str_split($filterString, 1); for($x = 0; $x < strlen($filterString); $x++) { $returnVal .= "(type <=> '" . getFilterName($filterLetters[$x]) . "') OR "; } if (strlen($returnVal) > 0) $returnVal = substr($returnVal,0,-4); //remove final " OR " from filterstring else $returnVal = "type = 'VOID'"; //if everything is filtered, make sure to set type to something not available return $returnVal; } parseFilterString("RBC");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PO4sh
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   INIT_FCALL                                               'parsefilterstring'
          1        SEND_VAL                                                 'RBC'
          2        DO_FCALL                                      0          
          3      > RETURN                                                   1

Function getfiltername:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PO4sh
function name:  getFilterName
number of ops:  5
compiled vars:  !0 = $filterAbbreviation, !1 = $filters
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        ASSIGN                                                   !1, <array>
   17     2        FETCH_DIM_R                                      ~3      !1, !0
          3      > RETURN                                                   ~3
   18     4*     > RETURN                                                   null

End of function getfiltername

Function parsefilterstring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 9
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 30
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 9
Branch analysis from position: 20
Branch analysis from position: 9
filename:       /in/PO4sh
function name:  parseFilterString
number of ops:  33
compiled vars:  !0 = $filterString, !1 = $returnVal, !2 = $filterLetters, !3 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   23     1        ASSIGN                                                   !1, ''
   24     2        INIT_FCALL                                               'str_split'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 1
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !2, $5
   25     7        ASSIGN                                                   !3, 0
          8      > JMP                                                      ->17
   26     9    >   INIT_FCALL                                               'getfiltername'
         10        FETCH_DIM_R                                      ~8      !2, !3
         11        SEND_VAL                                                 ~8
         12        DO_FCALL                                      0  $9      
         13        CONCAT                                           ~10     '%28type+%3C%3D%3E+%27', $9
         14        CONCAT                                           ~11     ~10, '%27%29+OR+'
         15        ASSIGN_OP                                     8          !1, ~11
   25    16        PRE_INC                                                  !3
         17    >   STRLEN                                           ~14     !0
         18        IS_SMALLER                                               !3, ~14
         19      > JMPNZ                                                    ~15, ->9
   28    20    >   STRLEN                                           ~16     !1
         21        IS_SMALLER                                               0, ~16
         22      > JMPZ                                                     ~17, ->30
         23    >   INIT_FCALL                                               'substr'
         24        SEND_VAR                                                 !1
         25        SEND_VAL                                                 0
         26        SEND_VAL                                                 -4
         27        DO_ICALL                                         $18     
         28        ASSIGN                                                   !1, $18
         29      > JMP                                                      ->31
   29    30    >   ASSIGN                                                   !1, 'type+%3D+%27VOID%27'
   30    31    > > RETURN                                                   !1
   31    32*     > RETURN                                                   null

End of function parsefilterstring

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.27 ms | 1403 KiB | 19 Q