3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace App\Classes; class EmailSubjectBase { protected $lead; protected $fetchedJobs; public function setLead($lead) { $this->lead = $lead; } public function setFetchedJobs($fetchedJobs) { $this->fetchedJobs = $fetchedJobs; } } class DynamicEmailSubject extends EmailSubjectBase { public function fillAndGet($subject) { dd($this->lead); $newSubject = str_replace($this->getAvailableDynamicPlaceholders(), $this->getDynamicPlaceHolderValues(), $subject); return $newSubject; } private function getAvailableDynamicPlaceholders() { return ["keyword"]; } private function getDynamicPlaceHolderValues() { return [ count($this->fetchedJobs), $this->lead->keyword, $this->lead->location, $this->lead->keyword, $this->lead->firstname, ]; } } function dd($a) { var_dump($a); } $d = new DynamicEmailSubject; $d->setLead((object)["keyword"=>"a", "location"=>"b", "firstname"=>"c"]); $d->setFetchedJobs([]); $d->fillAndGet("keyword location");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j9AmJ
function name:  (null)
number of ops:  14
compiled vars:  !0 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   NEW                                              $1      'App%5CClasses%5CDynamicEmailSubject'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   45     3        INIT_METHOD_CALL                                         !0, 'setLead'
          4        CAST                                          8  ~4      <array>
          5        SEND_VAL_EX                                              ~4
          6        DO_FCALL                                      0          
   46     7        INIT_METHOD_CALL                                         !0, 'setFetchedJobs'
          8        SEND_VAL_EX                                              <array>
          9        DO_FCALL                                      0          
   47    10        INIT_METHOD_CALL                                         !0, 'fillAndGet'
         11        SEND_VAL_EX                                              'keyword+location'
         12        DO_FCALL                                      0          
         13      > RETURN                                                   1

Function app%5Cclasses%5Cdd:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j9AmJ
function name:  App\Classes\dd
number of ops:  5
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   RECV                                             !0      
          1        INIT_NS_FCALL_BY_NAME                                    'App%5CClasses%5Cvar_dump'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4      > RETURN                                                   null

End of function app%5Cclasses%5Cdd

Class App\Classes\EmailSubjectBase:
Function setlead:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j9AmJ
function name:  setLead
number of ops:  4
compiled vars:  !0 = $lead
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   12     1        ASSIGN_OBJ                                               'lead'
          2        OP_DATA                                                  !0
   13     3      > RETURN                                                   null

End of function setlead

Function setfetchedjobs:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j9AmJ
function name:  setFetchedJobs
number of ops:  4
compiled vars:  !0 = $fetchedJobs
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        ASSIGN_OBJ                                               'fetchedJobs'
          2        OP_DATA                                                  !0
   18     3      > RETURN                                                   null

End of function setfetchedjobs

End of class App\Classes\EmailSubjectBase.

Class App\Classes\DynamicEmailSubject:
Function fillandget:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j9AmJ
function name:  fillAndGet
number of ops:  18
compiled vars:  !0 = $subject, !1 = $newSubject
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   24     1        INIT_NS_FCALL_BY_NAME                                    'App%5CClasses%5Cdd'
          2        CHECK_FUNC_ARG                                           
          3        FETCH_OBJ_FUNC_ARG                               $2      'lead'
          4        SEND_FUNC_ARG                                            $2
          5        DO_FCALL                                      0          
   25     6        INIT_NS_FCALL_BY_NAME                                    'App%5CClasses%5Cstr_replace'
          7        INIT_METHOD_CALL                                         'getAvailableDynamicPlaceholders'
          8        DO_FCALL                                      0  $4      
          9        SEND_VAR_NO_REF_EX                                       $4
         10        INIT_METHOD_CALL                                         'getDynamicPlaceHolderValues'
         11        DO_FCALL                                      0  $5      
         12        SEND_VAR_NO_REF_EX                                       $5
         13        SEND_VAR_EX                                              !0
         14        DO_FCALL                                      0  $6      
         15        ASSIGN                                                   !1, $6
   27    16      > RETURN                                                   !1
   28    17*     > RETURN                                                   null

End of function fillandget

Function getavailabledynamicplaceholders:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j9AmJ
function name:  getAvailableDynamicPlaceholders
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E > > RETURN                                                   <array>
   31     1*     > RETURN                                                   null

End of function getavailabledynamicplaceholders

Function getdynamicplaceholdervalues:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j9AmJ
function name:  getDynamicPlaceHolderValues
number of ops:  20
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   INIT_NS_FCALL_BY_NAME                                    'App%5CClasses%5Ccount'
          1        CHECK_FUNC_ARG                                           
          2        FETCH_OBJ_FUNC_ARG                               $0      'fetchedJobs'
          3        SEND_FUNC_ARG                                            $0
          4        DO_FCALL                                      0  $1      
          5        INIT_ARRAY                                       ~2      $1
   36     6        FETCH_OBJ_R                                      ~3      'lead'
          7        FETCH_OBJ_R                                      ~4      ~3, 'keyword'
          8        ADD_ARRAY_ELEMENT                                ~2      ~4
   37     9        FETCH_OBJ_R                                      ~5      'lead'
         10        FETCH_OBJ_R                                      ~6      ~5, 'location'
         11        ADD_ARRAY_ELEMENT                                ~2      ~6
   38    12        FETCH_OBJ_R                                      ~7      'lead'
         13        FETCH_OBJ_R                                      ~8      ~7, 'keyword'
         14        ADD_ARRAY_ELEMENT                                ~2      ~8
   39    15        FETCH_OBJ_R                                      ~9      'lead'
         16        FETCH_OBJ_R                                      ~10     ~9, 'firstname'
         17        ADD_ARRAY_ELEMENT                                ~2      ~10
         18      > RETURN                                                   ~2
   41    19*     > RETURN                                                   null

End of function getdynamicplaceholdervalues

Function setlead:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j9AmJ
function name:  setLead
number of ops:  4
compiled vars:  !0 = $lead
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   12     1        ASSIGN_OBJ                                               'lead'
          2        OP_DATA                                                  !0
   13     3      > RETURN                                                   null

End of function setlead

Function setfetchedjobs:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j9AmJ
function name:  setFetchedJobs
number of ops:  4
compiled vars:  !0 = $fetchedJobs
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        ASSIGN_OBJ                                               'fetchedJobs'
          2        OP_DATA                                                  !0
   18     3      > RETURN                                                   null

End of function setfetchedjobs

End of class App\Classes\DynamicEmailSubject.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.01 ms | 1411 KiB | 20 Q