3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class DataMapper { // 削除 public function delete(array $conditions): int { // 削除に失敗して例外が発生したと仮定 throw new RangeException('削除に失敗しました'); // 本来は削除に成功した行数を rowCount で得て返す return 1; } } class CommentMapper extends DataMapper { // コメント削除 public function destroyComment(int $comment_id): int { try { $conditions = ['id'=>$comment_id]; $rowCount = parent::delete($conditions); return $rowCount; } catch (Exception $e) { echo $e->getMessage(); } } } class CommentController { public function destroyAction(int $comment_id): void { $commentMapper = new CommentMapper(); $rowCount = $commentMapper->destroyComment($comment_id); var_dump($rowCount); } } $commentController = new CommentController(); $commentController->destroyAction(1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i5lbv
function name:  (null)
number of ops:  7
compiled vars:  !0 = $commentController
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   NEW                                              $1      'CommentController'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   40     3        INIT_METHOD_CALL                                         !0, 'destroyAction'
          4        SEND_VAL_EX                                              1
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Class DataMapper:
Function delete:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/i5lbv
function name:  delete
number of ops:  8
compiled vars:  !0 = $conditions
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    8     1        NEW                                              $1      'RangeException'
          2        SEND_VAL_EX                                              '%E5%89%8A%E9%99%A4%E3%81%AB%E5%A4%B1%E6%95%97%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F'
          3        DO_FCALL                                      0          
          4      > THROW                                         0          $1
   10     5*       RETURN                                                   1
   11     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function delete

End of class DataMapper.

Class CommentMapper:
Function destroycomment:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 10
Branch analysis from position: 10
2 jumps found. (Code = 107) Position 1 = 11, Position 2 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i5lbv
function name:  destroyComment
number of ops:  16
compiled vars:  !0 = $comment_id, !1 = $conditions, !2 = $rowCount, !3 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   20     1        INIT_ARRAY                                       ~4      !0, 'id'
          2        ASSIGN                                                   !1, ~4
   21     3        INIT_STATIC_METHOD_CALL                                  'delete'
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0  $6      
          6        ASSIGN                                                   !2, $6
   22     7        VERIFY_RETURN_TYPE                                       !2
          8      > RETURN                                                   !2
          9*       JMP                                                      ->14
   23    10  E > > CATCH                                       last         'Exception'
   24    11    >   INIT_METHOD_CALL                                         !3, 'getMessage'
         12        DO_FCALL                                      0  $8      
         13        ECHO                                                     $8
   26    14        VERIFY_RETURN_TYPE                                       
         15      > RETURN                                                   null

End of function destroycomment

Function delete:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/i5lbv
function name:  delete
number of ops:  8
compiled vars:  !0 = $conditions
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    8     1        NEW                                              $1      'RangeException'
          2        SEND_VAL_EX                                              '%E5%89%8A%E9%99%A4%E3%81%AB%E5%A4%B1%E6%95%97%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F'
          3        DO_FCALL                                      0          
          4      > THROW                                         0          $1
   10     5*       RETURN                                                   1
   11     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function delete

End of class CommentMapper.

Class CommentController:
Function destroyaction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i5lbv
function name:  destroyAction
number of ops:  12
compiled vars:  !0 = $comment_id, !1 = $commentMapper, !2 = $rowCount
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
   33     1        NEW                                              $3      'CommentMapper'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $3
   34     4        INIT_METHOD_CALL                                         !1, 'destroyComment'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $6      
          7        ASSIGN                                                   !2, $6
   35     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !2
         10        DO_ICALL                                                 
   36    11      > RETURN                                                   null

End of function destroyaction

End of class CommentController.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.48 ms | 1015 KiB | 14 Q