3v4l.org

run code in 300+ PHP versions simultaneously
<?php class PostRepository { public function getLatestPost() { $posts = [ [ 'id' => 1, 'title' => 'Judul Pertama', 'content' => 'Contoh Content Pertama', ], [ 'id' => 2, 'title' => 'Judul Kedua', 'content' => 'Contoh Content Kedua', ], [ 'id' => 3, 'title' => 'Judul Ketiga', 'content' => 'Contoh Content Ketiga', ], ]; return $posts; } } class SuffledPostRepository extends PostRepository { public function getLatestPost() { $posts = parent::getLatestPost(); shuffle($posts); return $posts; } } $postRepository = new PostRepository(); print_r($postRepository->getLatestPost()); $suffledPostRepository = new SuffledPostRepository(); print_r($suffledPostRepository->getLatestPost());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R1UsN
function name:  (null)
number of ops:  17
compiled vars:  !0 = $postRepository, !1 = $suffledPostRepository
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   NEW                                              $2      'PostRepository'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   43     3        INIT_FCALL                                               'print_r'
          4        INIT_METHOD_CALL                                         !0, 'getLatestPost'
          5        DO_FCALL                                      0  $5      
          6        SEND_VAR                                                 $5
          7        DO_ICALL                                                 
   45     8        NEW                                              $7      'SuffledPostRepository'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $7
   46    11        INIT_FCALL                                               'print_r'
         12        INIT_METHOD_CALL                                         !1, 'getLatestPost'
         13        DO_FCALL                                      0  $10     
         14        SEND_VAR                                                 $10
         15        DO_ICALL                                                 
   47    16      > RETURN                                                   1

Class PostRepository:
Function getlatestpost:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R1UsN
function name:  getLatestPost
number of ops:  3
compiled vars:  !0 = $posts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, <array>
   25     1      > RETURN                                                   !0
   26     2*     > RETURN                                                   null

End of function getlatestpost

End of class PostRepository.

Class SuffledPostRepository:
Function getlatestpost:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R1UsN
function name:  getLatestPost
number of ops:  8
compiled vars:  !0 = $posts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   INIT_STATIC_METHOD_CALL                                  'getLatestPost'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   36     3        INIT_FCALL                                               'shuffle'
          4        SEND_REF                                                 !0
          5        DO_ICALL                                                 
   38     6      > RETURN                                                   !0
   39     7*     > RETURN                                                   null

End of function getlatestpost

End of class SuffledPostRepository.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.96 ms | 1401 KiB | 17 Q