3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = array('SS2014', 'SU2014','FW2014','SS2013','SU2013','FW2013'); $results = array(); foreach($strings as $string){ $weight = 0; $weight_string = preg_replace("/[^0-9a-zA-Z]/", "", $string); $weight += ord(substr(strtolower($weight_string), 0)) * 1000; $weight += ord(substr(strtolower($weight_string), 1)) * 100; $weight += ord(substr(strtolower($weight_string), 2)) * 10; $weight += ord(substr(strtolower($weight_string), 3)); var_dump(substr(strtolower($weight_string), 1)); $results[] = $weight; } var_dump($results);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 71
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 71
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 71
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 71
filename:       /in/m1pMd
function name:  (null)
number of ops:  76
compiled vars:  !0 = $strings, !1 = $results, !2 = $string, !3 = $weight, !4 = $weight_string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     2      > FE_RESET_R                                       $7      !0, ->71
          3    > > FE_FETCH_R                                               $7, !2, ->71
    6     4    >   ASSIGN                                                   !3, 0
    7     5        INIT_FCALL                                               'preg_replace'
          6        SEND_VAL                                                 '%2F%5B%5E0-9a-zA-Z%5D%2F'
          7        SEND_VAL                                                 ''
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                         $9      
         10        ASSIGN                                                   !4, $9
    9    11        INIT_FCALL                                               'ord'
         12        INIT_FCALL                                               'substr'
         13        INIT_FCALL                                               'strtolower'
         14        SEND_VAR                                                 !4
         15        DO_ICALL                                         $11     
         16        SEND_VAR                                                 $11
         17        SEND_VAL                                                 0
         18        DO_ICALL                                         $12     
         19        SEND_VAR                                                 $12
         20        DO_ICALL                                         $13     
         21        MUL                                              ~14     $13, 1000
         22        ASSIGN_OP                                     1          !3, ~14
   11    23        INIT_FCALL                                               'ord'
         24        INIT_FCALL                                               'substr'
         25        INIT_FCALL                                               'strtolower'
         26        SEND_VAR                                                 !4
         27        DO_ICALL                                         $16     
         28        SEND_VAR                                                 $16
         29        SEND_VAL                                                 1
         30        DO_ICALL                                         $17     
         31        SEND_VAR                                                 $17
         32        DO_ICALL                                         $18     
         33        MUL                                              ~19     $18, 100
         34        ASSIGN_OP                                     1          !3, ~19
   12    35        INIT_FCALL                                               'ord'
         36        INIT_FCALL                                               'substr'
         37        INIT_FCALL                                               'strtolower'
         38        SEND_VAR                                                 !4
         39        DO_ICALL                                         $21     
         40        SEND_VAR                                                 $21
         41        SEND_VAL                                                 2
         42        DO_ICALL                                         $22     
         43        SEND_VAR                                                 $22
         44        DO_ICALL                                         $23     
         45        MUL                                              ~24     $23, 10
         46        ASSIGN_OP                                     1          !3, ~24
   13    47        INIT_FCALL                                               'ord'
         48        INIT_FCALL                                               'substr'
         49        INIT_FCALL                                               'strtolower'
         50        SEND_VAR                                                 !4
         51        DO_ICALL                                         $26     
         52        SEND_VAR                                                 $26
         53        SEND_VAL                                                 3
         54        DO_ICALL                                         $27     
         55        SEND_VAR                                                 $27
         56        DO_ICALL                                         $28     
         57        ASSIGN_OP                                     1          !3, $28
   14    58        INIT_FCALL                                               'var_dump'
         59        INIT_FCALL                                               'substr'
         60        INIT_FCALL                                               'strtolower'
         61        SEND_VAR                                                 !4
         62        DO_ICALL                                         $30     
         63        SEND_VAR                                                 $30
         64        SEND_VAL                                                 1
         65        DO_ICALL                                         $31     
         66        SEND_VAR                                                 $31
         67        DO_ICALL                                                 
   15    68        ASSIGN_DIM                                               !1
         69        OP_DATA                                                  !3
    5    70      > JMP                                                      ->3
         71    >   FE_FREE                                                  $7
   18    72        INIT_FCALL                                               'var_dump'
         73        SEND_VAR                                                 !1
         74        DO_ICALL                                                 
         75      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.29 ms | 1400 KiB | 23 Q