3v4l.org

run code in 300+ PHP versions simultaneously
<?php $telefones = [ '(11) 3333-4353', '(11) 98000-2222', '(11) 3027-5555', '(11) 97000-0333', '(12) 99999-9999', '(12) 88888-8888', '(13) 11111-1111' ]; $inicio = microtime(true); function sortNumber($a, $b) { $a = preg_replace('/\D/', '', $a); $b = preg_replace('/\D/', '', $b); return ($a > $b) ? -1 : 1; } for($i = 0; $i < 50000; $i++){ usort($telefones, 'sortNumber'); } echo 'Bruno Rigolon:' . (microtime(true) - $inicio) . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 7
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 7
Branch analysis from position: 14
Branch analysis from position: 7
filename:       /in/PBLUX
function name:  (null)
number of ops:  22
compiled vars:  !0 = $telefones, !1 = $inicio, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   15     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
   23     5        ASSIGN                                                   !2, 0
          6      > JMP                                                      ->12
   24     7    >   INIT_FCALL                                               'usort'
          8        SEND_REF                                                 !0
          9        SEND_VAL                                                 'sortNumber'
         10        DO_ICALL                                                 
   23    11        PRE_INC                                                  !2
         12    >   IS_SMALLER                                               !2, 50000
         13      > JMPNZ                                                    ~9, ->7
   28    14    >   INIT_FCALL                                               'microtime'
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $10     
         17        SUB                                              ~11     $10, !1
         18        CONCAT                                           ~12     'Bruno+Rigolon%3A', ~11
         19        CONCAT                                           ~13     ~12, '%0A'
         20        ECHO                                                     ~13
         21      > RETURN                                                   1

Function sortnumber:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PBLUX
function name:  sortNumber
number of ops:  21
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   18     2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAL                                                 '%2F%5CD%2F'
          4        SEND_VAL                                                 ''
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $2      
          7        ASSIGN                                                   !0, $2
   19     8        INIT_FCALL                                               'preg_replace'
          9        SEND_VAL                                                 '%2F%5CD%2F'
         10        SEND_VAL                                                 ''
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $4      
         13        ASSIGN                                                   !1, $4
   20    14        IS_SMALLER                                               !1, !0
         15      > JMPZ                                                     ~6, ->18
         16    >   QM_ASSIGN                                        ~7      -1
         17      > JMP                                                      ->19
         18    >   QM_ASSIGN                                        ~7      1
         19    > > RETURN                                                   ~7
   21    20*     > RETURN                                                   null

End of function sortnumber

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.57 ms | 1400 KiB | 19 Q