3v4l.org

run code in 300+ PHP versions simultaneously
<?php $animal = 'dog'; $age = 4; $sentance1 = 'The %s is %d years old'; $result1 = sprintf($sentance1, $animal, $age); $sentance2 = 'Age: %d. Animal: %s'; $result2 = sprintf($sentance2, $age, $animal); $sentance3 = 'Age: %2$d. Animal: %1$s'; $result3 = sprintf($sentance3, $animal, $age); print($result1 . PHP_EOL); print($result2 . PHP_EOL); print($result3 . PHP_EOL);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PvPe2
function name:  (null)
number of ops:  30
compiled vars:  !0 = $animal, !1 = $age, !2 = $sentance1, !3 = $result1, !4 = $sentance2, !5 = $result2, !6 = $sentance3, !7 = $result3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'dog'
    4     1        ASSIGN                                                   !1, 4
    6     2        ASSIGN                                                   !2, 'The+%25s+is+%25d+years+old'
    8     3        INIT_FCALL                                               'sprintf'
          4        SEND_VAR                                                 !2
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $11     
          8        ASSIGN                                                   !3, $11
   10     9        ASSIGN                                                   !4, 'Age%3A+%25d.+Animal%3A+%25s'
   12    10        INIT_FCALL                                               'sprintf'
         11        SEND_VAR                                                 !4
         12        SEND_VAR                                                 !1
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $14     
         15        ASSIGN                                                   !5, $14
   14    16        ASSIGN                                                   !6, 'Age%3A+%252%24d.+Animal%3A+%251%24s'
   16    17        INIT_FCALL                                               'sprintf'
         18        SEND_VAR                                                 !6
         19        SEND_VAR                                                 !0
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                         $17     
         22        ASSIGN                                                   !7, $17
   18    23        CONCAT                                           ~19     !3, '%0A'
         24        ECHO                                                     ~19
   19    25        CONCAT                                           ~20     !5, '%0A'
         26        ECHO                                                     ~20
   20    27        CONCAT                                           ~21     !7, '%0A'
         28        ECHO                                                     ~21
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.3 ms | 1436 KiB | 14 Q