3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'PHP is a widely-used general-purpose server side scripting language'; $eol = "\n"; $turned = function($str) use ($eol) { $length = max(array_map('strlen', $lines = explode($eol, trim($str)))); $each = function($a, $s) use ($length) { $a[] = str_split(sprintf("%' {$length}s", $s)); return $a; }; return implode($eol, array_map(function($v) { return implode(' ', $v); }, call_user_func_array('array_map', array_reduce($lines, $each, array(NULL)))) ); }; echo $turned($str), $eol;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sQVQt
function name:  (null)
number of ops:  11
compiled vars:  !0 = $str, !1 = $eol, !2 = $turned
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'PHP+is+a%0Awidely-used%0A%0Ageneral-purpose%0Aserver+side%0A%0Ascripting%0Alanguage'
   12     1        ASSIGN                                                   !1, '%0A'
   13     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FsQVQt%3A13%240'
          3        BIND_LEXICAL                                             ~5, !1
          4        ASSIGN                                                   !2, ~5
   30     5        INIT_DYNAMIC_CALL                                        !2
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $7      
          8        ECHO                                                     $7
          9        ECHO                                                     !1
         10      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FsQVQt%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sQVQt
function name:  {closure}
number of ops:  41
compiled vars:  !0 = $str, !1 = $eol, !2 = $length, !3 = $lines, !4 = $each
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   15     2        INIT_FCALL                                               'max'
          3        INIT_FCALL                                               'array_map'
          4        SEND_VAL                                                 'strlen'
          5        INIT_FCALL                                               'explode'
          6        SEND_VAR                                                 !1
          7        INIT_FCALL                                               'trim'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                         $6      
         12        ASSIGN                                           ~7      !3, $6
         13        SEND_VAL                                                 ~7
         14        DO_ICALL                                         $8      
         15        SEND_VAR                                                 $8
         16        DO_ICALL                                         $9      
         17        ASSIGN                                                   !2, $9
   16    18        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FsQVQt%3A16%241'
         19        BIND_LEXICAL                                             ~11, !2
         20        ASSIGN                                                   !4, ~11
   22    21        INIT_FCALL                                               'implode'
         22        SEND_VAR                                                 !1
         23        INIT_FCALL                                               'array_map'
         24        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FsQVQt%3A22%242'
   25    25        SEND_VAL                                                 ~13
   26    26        INIT_FCALL                                               'array_map'
         27        INIT_FCALL                                               'array_reduce'
         28        SEND_VAR                                                 !3
         29        SEND_VAR                                                 !4
         30        SEND_VAL                                                 <array>
         31        DO_ICALL                                         $14     
         32        SEND_ARRAY                                               $14
         33        CHECK_UNDEF_ARGS                                         
         34        DO_FCALL                                      0  $15     
         35        SEND_VAR                                                 $15
         36        DO_ICALL                                         $16     
         37        SEND_VAR                                                 $16
         38        DO_ICALL                                         $17     
         39      > RETURN                                                   $17
   28    40*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FsQVQt%3A13%240

Function %00%7Bclosure%7D%2Fin%2FsQVQt%3A16%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sQVQt
function name:  {closure}
number of ops:  17
compiled vars:  !0 = $a, !1 = $s, !2 = $length
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   18     3        INIT_FCALL                                               'str_split'
          4        INIT_FCALL                                               'sprintf'
          5        ROPE_INIT                                     3  ~5      '%25%27+'
          6        ROPE_ADD                                      1  ~5      ~5, !2
          7        ROPE_END                                      2  ~4      ~5, 's'
          8        SEND_VAL                                                 ~4
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $7      
         11        SEND_VAR                                                 $7
         12        DO_ICALL                                         $8      
         13        ASSIGN_DIM                                               !0
         14        OP_DATA                                                  $8
   19    15      > RETURN                                                   !0
   20    16*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FsQVQt%3A16%241

Function %00%7Bclosure%7D%2Fin%2FsQVQt%3A22%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sQVQt
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   24     1        INIT_FCALL                                               'implode'
          2        SEND_VAL                                                 '+'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5      > RETURN                                                   $1
   25     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FsQVQt%3A22%242

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.34 ms | 1404 KiB | 29 Q