3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '12345678'; $head = substr($str, 0, strlen($str)%3); $str = substr($str, strlen($head)); $str = preg_replace( '/(.{3})/', ' $1', $str ); echo trim($head . $str); //string(10) "12 345 678"
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aNeWh
function name:  (null)
number of ops:  27
compiled vars:  !0 = $str, !1 = $head
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '12345678'
    3     1        INIT_FCALL                                               'substr'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 0
          4        STRLEN                                           ~3      !0
          5        MOD                                              ~4      ~3, 3
          6        SEND_VAL                                                 ~4
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !1, $5
    4     9        INIT_FCALL                                               'substr'
         10        SEND_VAR                                                 !0
         11        STRLEN                                           ~7      !1
         12        SEND_VAL                                                 ~7
         13        DO_ICALL                                         $8      
         14        ASSIGN                                                   !0, $8
    5    15        INIT_FCALL                                               'preg_replace'
    6    16        SEND_VAL                                                 '%2F%28.%7B3%7D%29%2F'
    7    17        SEND_VAL                                                 '+%241'
    8    18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $10     
    5    20        ASSIGN                                                   !0, $10
   10    21        INIT_FCALL                                               'trim'
         22        CONCAT                                           ~12     !1, !0
         23        SEND_VAL                                                 ~12
         24        DO_ICALL                                         $13     
         25        ECHO                                                     $13
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.77 ms | 1395 KiB | 19 Q