3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Model { public function tableName(): string; } abstract class AbstractTable implements Model { public function tableName(): string { return constant('static::TABLE_NAME'); } } final class SomeTable extends AbstractTable { public const TABLE_NAME = 'some_table'; } $table = new SomeTable(); var_dump($table->tableName()); // $pdo->prepare(sprintf("SELECT * FROM %s", $table->tableName());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kH1qE
function name:  (null)
number of ops:  11
compiled vars:  !0 = $table
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   DECLARE_CLASS                                            'abstracttable'
   13     1        DECLARE_CLASS                                            'sometable', 'abstracttable'
   17     2        NEW                                              $1      'SomeTable'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   18     5        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !0, 'tableName'
          7        DO_FCALL                                      0  $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                                 
   19    10      > RETURN                                                   1

Class Model:
Function tablename:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kH1qE
function name:  tableName
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   VERIFY_RETURN_TYPE                                       
          1      > RETURN                                                   null

End of function tablename

End of class Model.

Class AbstractTable:
Function tablename:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kH1qE
function name:  tableName
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'constant'
          1        SEND_VAL                                                 'static%3A%3ATABLE_NAME'
          2        DO_ICALL                                         $0      
          3        VERIFY_RETURN_TYPE                                       $0
          4      > RETURN                                                   $0
   10     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function tablename

End of class AbstractTable.

Class SomeTable: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.72 ms | 1395 KiB | 17 Q