3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sql = "SELECT * FROM 'main' WHERE 'destination' = 'Helsinki' AND 'price' > 120"; //example of sql query //the following assumes the above SQL query has been parsed into fields and conditions //main header file. Stored as JSON. $main_db_header_contents = '[{"rowlength":60},{"id":{"length":3,"datatype":"integer"}},{"name_sname":{"length":9,"datatype":"String"}},{"identity":{"length":9,"datatype":"integer"}},{"address":{"length":8,"datatype":"String"}},{"region":{"length":7,"datatype":"String"}},{"hours":{"length":5,"datatype":"Time"}},{"destination":{"length":8,"datatype":"String"}},{"price":{"length":3,"datatype":"integer"}}]'; //json string. fairly immutable so it can be cached on server $main_db_header = json_decode($main_db_header_contents,true); //$row_length = $main_db_header[0]['rowlength']; //id, length, datatype //var_dump($row_length); //main database file. Columns are fixed length and padded. Stored as strings only. ID field must be sorted alphabetically. //When fields in this file are updated/added to, their respective index file must be too $main_db_file_contents = "001|Al-Farabi|123456789|Baghdad |Iraq |21:02|Ottawa |120;002|Smith |123456788|Ottawa |Canada |22:03|Helsinki|131;003|Locke |123456787|Helsinki|Finland|23:01|Istanbul|122;004|Jones |123456786|Istanbul|Turkey |21:02|Helsinki|123;005|Steinman |123455785|Havana |Cuba |22:03|Havana |104;006|Booker |123456784|Moscow |Russia |23:01|Helsinki|115;"; //fixed-length field values //Destination index file with record id and destination value. Sorted alphabetically. //E.g., The record with the id of 004 has the destination value of 'Moscow '. $destination_index_file_contents = "005|Havana ;002|Helsinki;004|Helsinki;006|Helsinki;003|Istanbul;001|Ottawa "; //Destination index file. Sorted alphabetically despite being numberic. //E.g., The record with the id of 005 has the price value of 104. $price_index_file_contents = "005|104;006|115;001|120;003|122;004|123;002|131"; function apply_condition($index_file_contents, $ptype, $value) { $found_matches = []; $index_file_contents_split = explode(";", $index_file_contents); foreach($index_file_contents_split as $key => $props){ $pairs = explode("|",$props); $id = $pairs[0]; $val = trim($pairs[1]); //removes trailing spaces for matching non-fiexed-length input value if ($ptype === "=") { if ($val === $value) { array_push($found_matches,$id); //add to new array of matches } } elseif ($ptype === ">") { if ($val > $value) { array_push($found_matches,$id);//add to new array of matches } } } return $found_matches; } $parsed_destinations = apply_condition($destination_index_file_contents, "=", "Helsinki"); $parsed_prices = apply_condition($price_index_file_contents, ">", "120"); $parsed_ids = array_intersect($parsed_destinations, $parsed_prices); sort($parsed_ids); //sort ascending //now go through $main_db_file_contents and get selected fields in records matching the ids in $parsed_ids. $id_length = $main_db_header[1]['id']['length']; //id, length, datatype $destination_offset = get_field_offset("destination", $main_db_header); $price_offset = get_field_offset("price", $main_db_header); $destination_length = $main_db_header[7]['destination']['length']; //8 $price_length = $main_db_header[8]['price']['length']; //3 $row_length = $main_db_header[0]['rowlength']; //147 $main_file_length = strlen($main_db_file_contents); $total_main_file_rows = ($main_file_length/$row_length); //$starting_row = get_starting_row($main_db_file_contents, $parsed_ids[0], $id_length, $row_length, $total_main_file_rows, 0); $destinations = []; $prices = []; $starting_row = 0; //for ($i = 0; $i < count($parsed_ids); $i++){ for ($i = 0; $i < count($parsed_ids); $i++){ $starting_row = get_starting_row($main_db_file_contents, $parsed_ids[$i], $id_length, $row_length, $total_main_file_rows, $starting_row); $destination = get_field_from_row($main_db_file_contents, $starting_row, $row_length, $destination_offset, $destination_length); //var_dump($destination); array_push($destinations, $destination); $price = get_field_from_row($main_db_file_contents, $starting_row, $row_length, $price_offset, $price_length); //var_dump($price); array_push($prices, $price); //$starting_row++; //$starting_row = get_starting_row($main_db_file_contents, $parsed_ids[0], $id_length, $row_length, $total_main_file_rows, $starting_row); //$starting_row = get_starting_row($main_db_file_contents, $parsed_ids[$i], $id_length, $row_length, $total_main_file_rows, $starting_row); } function get_field_from_row($db, $current_row, $row_length, $field_offset, $field_length) { //$value = substr($db, ($current_row * $row_length) + $field_offset, $field_length); $value = substr($db, ($current_row * $row_length) + $field_offset, $field_length); return $value; } function get_next_row($db, $id, $id_length, $row_length,$total_main_file_rows, $current_row){ //returns index of row that that has the given id } function get_starting_row($db, $first_id, $id_length, $row_length, $total_main_file_rows, $offset){ $start_row = (int)floor($total_main_file_rows / 2) + $offset; //halfway point of file $start_row_id = substr($db, ($start_row) * $row_length , $id_length); //gets current row id while ($start_row > -1 && $start_row <= $total_main_file_rows) { //var_dump($start_row); print ("\nseeing if ".$first_id." is less than ".$start_row_id); if ( $first_id < $start_row_id){ print("\nIT LOWER!"); //print ("seeing if ".$first_id." is less than ".$row_id); //go back a bit less $start_row = (int)floor($start_row / 2); //print("\n" . $start_row); $start_row_id = substr($db, ($start_row) * $row_length , $id_length); //print("\nstarting row: " . $start_row . "\n"); //print("\n" . $first_id . ", " . $row_id); } elseif($start_row_id < $first_id) { //go forward a bit less //$start_row++; //new //$start_row = $start_row + (int)round($start_row / 2); $start_row = (int)ceil($start_row / 2) + $start_row +2; //$start_row++; print("\nIT HIGHER!"); //print("\nstarting row: " . $start_row . "\n"); //print("\n" . $start_row); //print("\n" . $first_id . ", " . $row_id); } else { print("\nIT IS THE SAME!"); //print("\nrow found: " . $start_row . "\n"); return $start_row; } } //return $row_id; } function get_field_offset($field, $header) { $total_offset = 0; foreach ($header as $key => $value){ foreach ($value as $k => $val) { if ($k != "rowlength"){ if ($field === (string)$k){ //var_dump($k); return $total_offset; } $total_offset += $val['length'] +1; //+1 is needed for single-character delimeter (|) } } } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 100
Branch analysis from position: 100
2 jumps found. (Code = 44) Position 1 = 103, Position 2 = 64
Branch analysis from position: 103
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 64
2 jumps found. (Code = 44) Position 1 = 103, Position 2 = 64
Branch analysis from position: 103
Branch analysis from position: 64
filename:       /in/cUS2P
function name:  (null)
number of ops:  104
compiled vars:  !0 = $sql, !1 = $main_db_header_contents, !2 = $main_db_header, !3 = $main_db_file_contents, !4 = $destination_index_file_contents, !5 = $price_index_file_contents, !6 = $parsed_destinations, !7 = $parsed_prices, !8 = $parsed_ids, !9 = $id_length, !10 = $destination_offset, !11 = $price_offset, !12 = $destination_length, !13 = $price_length, !14 = $row_length, !15 = $main_file_length, !16 = $total_main_file_rows, !17 = $destinations, !18 = $prices, !19 = $starting_row, !20 = $i, !21 = $destination, !22 = $price
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'SELECT+%2A+FROM+%27main%27+WHERE+%27destination%27+%3D+%27Helsinki%27+AND+%27price%27+%3E+120'
    7     1        ASSIGN                                                   !1, '%5B%7B%22rowlength%22%3A60%7D%2C%7B%22id%22%3A%7B%22length%22%3A3%2C%22datatype%22%3A%22integer%22%7D%7D%2C%7B%22name_sname%22%3A%7B%22length%22%3A9%2C%22datatype%22%3A%22String%22%7D%7D%2C%7B%22identity%22%3A%7B%22length%22%3A9%2C%22datatype%22%3A%22integer%22%7D%7D%2C%7B%22address%22%3A%7B%22length%22%3A8%2C%22datatype%22%3A%22String%22%7D%7D%2C%7B%22region%22%3A%7B%22length%22%3A7%2C%22datatype%22%3A%22String%22%7D%7D%2C%7B%22hours%22%3A%7B%22length%22%3A5%2C%22datatype%22%3A%22Time%22%7D%7D%2C%7B%22destination%22%3A%7B%22length%22%3A8%2C%22datatype%22%3A%22String%22%7D%7D%2C%7B%22price%22%3A%7B%22length%22%3A3%2C%22datatype%22%3A%22integer%22%7D%7D%5D'
    9     2        INIT_FCALL                                               'json_decode'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $25     
          6        ASSIGN                                                   !2, $25
   15     7        ASSIGN                                                   !3, '001%7CAl-Farabi%7C123456789%7CBaghdad+%7CIraq+++%7C21%3A02%7COttawa++%7C120%3B002%7CSmith++++%7C123456788%7COttawa++%7CCanada+%7C22%3A03%7CHelsinki%7C131%3B003%7CLocke++++%7C123456787%7CHelsinki%7CFinland%7C23%3A01%7CIstanbul%7C122%3B004%7CJones++++%7C123456786%7CIstanbul%7CTurkey+%7C21%3A02%7CHelsinki%7C123%3B005%7CSteinman+%7C123455785%7CHavana++%7CCuba+++%7C22%3A03%7CHavana++%7C104%3B006%7CBooker+++%7C123456784%7CMoscow++%7CRussia+%7C23%3A01%7CHelsinki%7C115%3B'
   19     8        ASSIGN                                                   !4, '005%7CHavana++%3B002%7CHelsinki%3B004%7CHelsinki%3B006%7CHelsinki%3B003%7CIstanbul%3B001%7COttawa++'
   23     9        ASSIGN                                                   !5, '005%7C104%3B006%7C115%3B001%7C120%3B003%7C122%3B004%7C123%3B002%7C131'
   45    10        INIT_FCALL                                               'apply_condition'
         11        SEND_VAR                                                 !4
         12        SEND_VAL                                                 '%3D'
         13        SEND_VAL                                                 'Helsinki'
         14        DO_FCALL                                      0  $30     
         15        ASSIGN                                                   !6, $30
   46    16        INIT_FCALL                                               'apply_condition'
         17        SEND_VAR                                                 !5
         18        SEND_VAL                                                 '%3E'
         19        SEND_VAL                                                 '120'
         20        DO_FCALL                                      0  $32     
         21        ASSIGN                                                   !7, $32
   47    22        INIT_FCALL                                               'array_intersect'
         23        SEND_VAR                                                 !6
         24        SEND_VAR                                                 !7
         25        DO_ICALL                                         $34     
         26        ASSIGN                                                   !8, $34
   48    27        INIT_FCALL                                               'sort'
         28        SEND_REF                                                 !8
         29        DO_ICALL                                                 
   51    30        FETCH_DIM_R                                      ~37     !2, 1
         31        FETCH_DIM_R                                      ~38     ~37, 'id'
         32        FETCH_DIM_R                                      ~39     ~38, 'length'
         33        ASSIGN                                                   !9, ~39
   52    34        INIT_FCALL_BY_NAME                                       'get_field_offset'
         35        SEND_VAL_EX                                              'destination'
         36        SEND_VAR_EX                                              !2
         37        DO_FCALL                                      0  $41     
         38        ASSIGN                                                   !10, $41
   53    39        INIT_FCALL_BY_NAME                                       'get_field_offset'
         40        SEND_VAL_EX                                              'price'
         41        SEND_VAR_EX                                              !2
         42        DO_FCALL                                      0  $43     
         43        ASSIGN                                                   !11, $43
   54    44        FETCH_DIM_R                                      ~45     !2, 7
         45        FETCH_DIM_R                                      ~46     ~45, 'destination'
         46        FETCH_DIM_R                                      ~47     ~46, 'length'
         47        ASSIGN                                                   !12, ~47
   55    48        FETCH_DIM_R                                      ~49     !2, 8
         49        FETCH_DIM_R                                      ~50     ~49, 'price'
         50        FETCH_DIM_R                                      ~51     ~50, 'length'
         51        ASSIGN                                                   !13, ~51
   56    52        FETCH_DIM_R                                      ~53     !2, 0
         53        FETCH_DIM_R                                      ~54     ~53, 'rowlength'
         54        ASSIGN                                                   !14, ~54
   58    55        STRLEN                                           ~56     !3
         56        ASSIGN                                                   !15, ~56
   59    57        DIV                                              ~58     !15, !14
         58        ASSIGN                                                   !16, ~58
   63    59        ASSIGN                                                   !17, <array>
   64    60        ASSIGN                                                   !18, <array>
   66    61        ASSIGN                                                   !19, 0
   69    62        ASSIGN                                                   !20, 0
         63      > JMP                                                      ->100
   71    64    >   INIT_FCALL_BY_NAME                                       'get_starting_row'
         65        SEND_VAR_EX                                              !3
         66        CHECK_FUNC_ARG                                           
         67        FETCH_DIM_FUNC_ARG                               $64     !8, !20
         68        SEND_FUNC_ARG                                            $64
         69        SEND_VAR_EX                                              !9
         70        SEND_VAR_EX                                              !14
         71        SEND_VAR_EX                                              !16
         72        SEND_VAR_EX                                              !19
         73        DO_FCALL                                      0  $65     
         74        ASSIGN                                                   !19, $65
   73    75        INIT_FCALL_BY_NAME                                       'get_field_from_row'
         76        SEND_VAR_EX                                              !3
         77        SEND_VAR_EX                                              !19
         78        SEND_VAR_EX                                              !14
         79        SEND_VAR_EX                                              !10
         80        SEND_VAR_EX                                              !12
         81        DO_FCALL                                      0  $67     
         82        ASSIGN                                                   !21, $67
   75    83        INIT_FCALL                                               'array_push'
         84        SEND_REF                                                 !17
         85        SEND_VAR                                                 !21
         86        DO_ICALL                                                 
   77    87        INIT_FCALL_BY_NAME                                       'get_field_from_row'
         88        SEND_VAR_EX                                              !3
         89        SEND_VAR_EX                                              !19
         90        SEND_VAR_EX                                              !14
         91        SEND_VAR_EX                                              !11
         92        SEND_VAR_EX                                              !13
         93        DO_FCALL                                      0  $70     
         94        ASSIGN                                                   !22, $70
   79    95        INIT_FCALL                                               'array_push'
         96        SEND_REF                                                 !18
         97        SEND_VAR                                                 !22
         98        DO_ICALL                                                 
   69    99        PRE_INC                                                  !20
        100    >   COUNT                                            ~74     !8
        101        IS_SMALLER                                               !20, ~74
        102      > JMPNZ                                                    ~75, ->64
  147   103    > > RETURN                                                   1

Function apply_condition:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 42
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 42
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 33
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 32
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 32
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 41
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 41
Branch analysis from position: 41
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
filename:       /in/cUS2P
function name:  apply_condition
number of ops:  45
compiled vars:  !0 = $index_file_contents, !1 = $ptype, !2 = $value, !3 = $found_matches, !4 = $index_file_contents_split, !5 = $props, !6 = $key, !7 = $pairs, !8 = $id, !9 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   26     3        ASSIGN                                                   !3, <array>
   27     4        INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '%3B'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $11     
          8        ASSIGN                                                   !4, $11
   28     9      > FE_RESET_R                                       $13     !4, ->42
         10    > > FE_FETCH_R                                       ~14     $13, !5, ->42
         11    >   ASSIGN                                                   !6, ~14
   29    12        INIT_FCALL                                               'explode'
         13        SEND_VAL                                                 '%7C'
         14        SEND_VAR                                                 !5
         15        DO_ICALL                                         $16     
         16        ASSIGN                                                   !7, $16
   30    17        FETCH_DIM_R                                      ~18     !7, 0
         18        ASSIGN                                                   !8, ~18
   31    19        INIT_FCALL                                               'trim'
         20        FETCH_DIM_R                                      ~20     !7, 1
         21        SEND_VAL                                                 ~20
         22        DO_ICALL                                         $21     
         23        ASSIGN                                                   !9, $21
   32    24        IS_IDENTICAL                                             !1, '%3D'
         25      > JMPZ                                                     ~23, ->33
   33    26    >   IS_IDENTICAL                                             !9, !2
         27      > JMPZ                                                     ~24, ->32
   34    28    >   INIT_FCALL                                               'array_push'
         29        SEND_REF                                                 !3
         30        SEND_VAR                                                 !8
         31        DO_ICALL                                                 
         32    > > JMP                                                      ->41
   36    33    >   IS_IDENTICAL                                             !1, '%3E'
         34      > JMPZ                                                     ~26, ->41
   37    35    >   IS_SMALLER                                               !2, !9
         36      > JMPZ                                                     ~27, ->41
   38    37    >   INIT_FCALL                                               'array_push'
         38        SEND_REF                                                 !3
         39        SEND_VAR                                                 !8
         40        DO_ICALL                                                 
   28    41    > > JMP                                                      ->10
         42    >   FE_FREE                                                  $13
   42    43      > RETURN                                                   !3
   43    44*     > RETURN                                                   null

End of function apply_condition

Function get_field_from_row:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cUS2P
function name:  get_field_from_row
number of ops:  15
compiled vars:  !0 = $db, !1 = $current_row, !2 = $row_length, !3 = $field_offset, !4 = $field_length, !5 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   88     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
   90     5        INIT_FCALL                                               'substr'
          6        SEND_VAR                                                 !0
          7        MUL                                              ~6      !1, !2
          8        ADD                                              ~7      ~6, !3
          9        SEND_VAL                                                 ~7
         10        SEND_VAR                                                 !4
         11        DO_ICALL                                         $8      
         12        ASSIGN                                                   !5, $8
   91    13      > RETURN                                                   !5
   92    14*     > RETURN                                                   null

End of function get_field_from_row

Function get_next_row:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cUS2P
function name:  get_next_row
number of ops:  7
compiled vars:  !0 = $db, !1 = $id, !2 = $id_length, !3 = $row_length, !4 = $total_main_file_rows, !5 = $current_row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   94     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
          5        RECV                                             !5      
   98     6      > RETURN                                                   null

End of function get_next_row

Function get_starting_row:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
2 jumps found. (Code = 46) Position 1 = 58, Position 2 = 60
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 61, Position 2 = 21
Branch analysis from position: 61
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 42
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 54
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 60
filename:       /in/cUS2P
function name:  get_starting_row
number of ops:  62
compiled vars:  !0 = $db, !1 = $first_id, !2 = $id_length, !3 = $row_length, !4 = $total_main_file_rows, !5 = $offset, !6 = $start_row, !7 = $start_row_id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  100     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
          5        RECV                                             !5      
  101     6        INIT_FCALL                                               'floor'
          7        DIV                                              ~8      !4, 2
          8        SEND_VAL                                                 ~8
          9        DO_ICALL                                         $9      
         10        CAST                                          4  ~10     $9
         11        ADD                                              ~11     ~10, !5
         12        ASSIGN                                                   !6, ~11
  102    13        INIT_FCALL                                               'substr'
         14        SEND_VAR                                                 !0
         15        MUL                                              ~13     !6, !3
         16        SEND_VAL                                                 ~13
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                         $14     
         19        ASSIGN                                                   !7, $14
  103    20      > JMP                                                      ->56
  105    21    >   CONCAT                                           ~16     '%0Aseeing+if+', !1
         22        CONCAT                                           ~17     ~16, '+is+less+than+'
         23        CONCAT                                           ~18     ~17, !7
         24        ECHO                                                     ~18
  106    25        IS_SMALLER                                               !1, !7
         26      > JMPZ                                                     ~19, ->42
  107    27    >   ECHO                                                     '%0AIT+LOWER%21'
  110    28        INIT_FCALL                                               'floor'
         29        DIV                                              ~20     !6, 2
         30        SEND_VAL                                                 ~20
         31        DO_ICALL                                         $21     
         32        CAST                                          4  ~22     $21
         33        ASSIGN                                                   !6, ~22
  112    34        INIT_FCALL                                               'substr'
         35        SEND_VAR                                                 !0
         36        MUL                                              ~24     !6, !3
         37        SEND_VAL                                                 ~24
         38        SEND_VAR                                                 !2
         39        DO_ICALL                                         $25     
         40        ASSIGN                                                   !7, $25
         41      > JMP                                                      ->56
  115    42    >   IS_SMALLER                                               !7, !1
         43      > JMPZ                                                     ~27, ->54
  119    44    >   INIT_FCALL                                               'ceil'
         45        DIV                                              ~28     !6, 2
         46        SEND_VAL                                                 ~28
         47        DO_ICALL                                         $29     
         48        CAST                                          4  ~30     $29
         49        ADD                                              ~31     ~30, !6
         50        ADD                                              ~32     ~31, 2
         51        ASSIGN                                                   !6, ~32
  121    52        ECHO                                                     '%0AIT+HIGHER%21'
         53      > JMP                                                      ->56
  126    54    >   ECHO                                                     '%0AIT+IS+THE+SAME%21'
  128    55      > RETURN                                                   !6
  103    56    >   IS_SMALLER                                       ~34     -1, !6
         57      > JMPZ_EX                                          ~34     ~34, ->60
         58    >   IS_SMALLER_OR_EQUAL                              ~35     !6, !4
         59        BOOL                                             ~34     ~35
         60    > > JMPNZ                                                    ~34, ->21
  132    61    > > RETURN                                                   null

End of function get_starting_row

Function get_field_offset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 23
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 23
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 21
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 21
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 20
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 20
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 21
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/cUS2P
function name:  get_field_offset
number of ops:  25
compiled vars:  !0 = $field, !1 = $header, !2 = $total_offset, !3 = $value, !4 = $key, !5 = $val, !6 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  134     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  135     2        ASSIGN                                                   !2, 0
  136     3      > FE_RESET_R                                       $8      !1, ->23
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->23
          5    >   ASSIGN                                                   !4, ~9
  137     6      > FE_RESET_R                                       $11     !3, ->21
          7    > > FE_FETCH_R                                       ~12     $11, !5, ->21
          8    >   ASSIGN                                                   !6, ~12
  138     9        IS_NOT_EQUAL                                             !6, 'rowlength'
         10      > JMPZ                                                     ~14, ->20
  139    11    >   CAST                                          6  ~15     !6
         12        IS_IDENTICAL                                             !0, ~15
         13      > JMPZ                                                     ~16, ->17
  141    14    >   FE_FREE                                                  $11
         15        FE_FREE                                                  $8
         16      > RETURN                                                   !2
  143    17    >   FETCH_DIM_R                                      ~17     !5, 'length'
         18        ADD                                              ~18     ~17, 1
         19        ASSIGN_OP                                     1          !2, ~18
  137    20    > > JMP                                                      ->7
         21    >   FE_FREE                                                  $11
  136    22      > JMP                                                      ->4
         23    >   FE_FREE                                                  $8
  147    24      > RETURN                                                   null

End of function get_field_offset

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.2 ms | 1427 KiB | 33 Q