3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pdo = new pdo( 'sqlite::memory:', null, null, [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_GROUP | PDO::FETCH_FUNC ] ); $pdo->exec('create table x(sort int, foo text, bar text)'); $pdo->exec("insert into x(sort, foo, bar) values (1, 'a', 'b'), (1, 'c', 'd'), (2, 'e', 'f')"); $pdo->query('select * from x') ->fetchAll( PDO::FETCH_GROUP | PDO::FETCH_FUNC, function () { static $i = 0; $i++; echo "row $i\n"; var_dump(func_get_args()); } );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PGDS4
function name:  (null)
number of ops:  22
compiled vars:  !0 = $pdo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $1      'pdo'
    4     1        SEND_VAL_EX                                              'sqlite%3A%3Amemory%3A'
    5     2        SEND_VAL_EX                                              null
    6     3        SEND_VAL_EX                                              null
    8     4        SEND_VAL_EX                                              <array>
          5        DO_FCALL                                      0          
    3     6        ASSIGN                                                   !0, $1
   13     7        INIT_METHOD_CALL                                         !0, 'exec'
          8        SEND_VAL_EX                                              'create+table+x%28sort+int%2C+foo+text%2C+bar+text%29'
          9        DO_FCALL                                      0          
   14    10        INIT_METHOD_CALL                                         !0, 'exec'
         11        SEND_VAL_EX                                              'insert+into+x%28sort%2C+foo%2C+bar%29+values+%281%2C+%27a%27%2C+%27b%27%29%2C+%281%2C+%27c%27%2C+%27d%27%29%2C+%282%2C+%27e%27%2C+%27f%27%29'
         12        DO_FCALL                                      0          
   16    13        INIT_METHOD_CALL                                         !0, 'query'
         14        SEND_VAL_EX                                              'select+%2A+from+x'
         15        DO_FCALL                                      0  $6      
   17    16        INIT_METHOD_CALL                                         $6, 'fetchAll'
   18    17        SEND_VAL_EX                                              65546
   19    18        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FPGDS4%3A19%240'
   24    19        SEND_VAL_EX                                              ~7
         20        DO_FCALL                                      0          
   25    21      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FPGDS4%3A19%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PGDS4
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   BIND_STATIC                                              !0
   21     1        PRE_INC                                                  !0
   22     2        ROPE_INIT                                     3  ~3      'row+'
          3        ROPE_ADD                                      1  ~3      ~3, !0
          4        ROPE_END                                      2  ~2      ~3, '%0A'
          5        ECHO                                                     ~2
   23     6        INIT_FCALL                                               'var_dump'
          7        FUNC_GET_ARGS                                    ~5      
          8        SEND_VAL                                                 ~5
          9        DO_ICALL                                                 
   24    10      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FPGDS4%3A19%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.49 ms | 1396 KiB | 15 Q