3v4l.org

run code in 300+ PHP versions simultaneously
<?php $format = function ($money) { $pieces = explode('.', $money); $cents = $pieces[1]; $dollars = $pieces[0]; //1000000.50 //1000000 50 //0000001 $str = strrev($dollars); $out = ''; for ($i = 0; $i < strlen($str); $i++) { if ($i % 3 == 0 && $i !== 0) { $out .= ','; } $out .= $str[$i]; } $out = '$' . strrev($out) . '.' . $cents; return $out; }; echo $format('100000');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/euoSK
function name:  (null)
number of ops:  7
compiled vars:  !0 = $format
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FeuoSK%3A3%240'
          1        ASSIGN                                                   !0, ~1
   27     2        INIT_DYNAMIC_CALL                                        !0
          3        SEND_VAL_EX                                              '100000'
          4        DO_FCALL                                      0  $3      
          5        ECHO                                                     $3
          6      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FeuoSK%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 17
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 24
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 17
Branch analysis from position: 30
Branch analysis from position: 17
Branch analysis from position: 24
Branch analysis from position: 22
filename:       /in/euoSK
function name:  {closure}
number of ops:  39
compiled vars:  !0 = $money, !1 = $pieces, !2 = $cents, !3 = $dollars, !4 = $str, !5 = $out, !6 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '.'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !1, $7
    5     6        FETCH_DIM_R                                      ~9      !1, 1
          7        ASSIGN                                                   !2, ~9
    6     8        FETCH_DIM_R                                      ~11     !1, 0
          9        ASSIGN                                                   !3, ~11
   12    10        INIT_FCALL                                               'strrev'
         11        SEND_VAR                                                 !3
         12        DO_ICALL                                         $13     
         13        ASSIGN                                                   !4, $13
   13    14        ASSIGN                                                   !5, ''
   15    15        ASSIGN                                                   !6, 0
         16      > JMP                                                      ->27
   16    17    >   MOD                                              ~17     !6, 3
         18        IS_EQUAL                                         ~18     ~17, 0
         19      > JMPZ_EX                                          ~18     ~18, ->22
         20    >   IS_NOT_IDENTICAL                                 ~19     !6, 0
         21        BOOL                                             ~18     ~19
         22    > > JMPZ                                                     ~18, ->24
   17    23    >   ASSIGN_OP                                     8          !5, '%2C'
   19    24    >   FETCH_DIM_R                                      ~21     !4, !6
         25        ASSIGN_OP                                     8          !5, ~21
   15    26        PRE_INC                                                  !6
         27    >   STRLEN                                           ~24     !4
         28        IS_SMALLER                                               !6, ~24
         29      > JMPNZ                                                    ~25, ->17
   22    30    >   INIT_FCALL                                               'strrev'
         31        SEND_VAR                                                 !5
         32        DO_ICALL                                         $26     
         33        CONCAT                                           ~27     '%24', $26
         34        CONCAT                                           ~28     ~27, '.'
         35        CONCAT                                           ~29     ~28, !2
         36        ASSIGN                                                   !5, ~29
   24    37      > RETURN                                                   !5
   25    38*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FeuoSK%3A3%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.3 ms | 1400 KiB | 17 Q