3v4l.org

run code in 300+ PHP versions simultaneously
<?php $before = 'I have 10000 dollars.'; $expect = 'I have 10,000 dollars.'; $result = preg_replace_callback( '/\d+/', function($number) { return number_format($number[0]); }, $before ); var_dump($result === $expect); echo $result;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oK7bk
function name:  (null)
number of ops:  15
compiled vars:  !0 = $before, !1 = $expect, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'I+have+10000+dollars.'
    4     1        ASSIGN                                                   !1, 'I+have+10%2C000+dollars.'
    6     2        INIT_FCALL                                               'preg_replace_callback'
    7     3        SEND_VAL                                                 '%2F%5Cd%2B%2F'
    8     4        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
   10     5        SEND_VAL                                                 ~5
   11     6        SEND_VAR                                                 !0
    6     7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !2, $6
   14     9        INIT_FCALL                                               'var_dump'
         10        IS_IDENTICAL                                     ~8      !2, !1
         11        SEND_VAL                                                 ~8
         12        DO_ICALL                                                 
   15    13        ECHO                                                     !2
   16    14      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oK7bk
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'number_format'
          2        FETCH_DIM_R                                      ~1      !0, 0
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                         $2      
          5      > RETURN                                                   $2
   10     6*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.9 ms | 1004 KiB | 16 Q