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");
Output for git.master_jit, git.master, rfc.property-hooks
object(stdClass)#2 (3) { ["keyword"]=> string(1) "a" ["location"]=> string(1) "b" ["firstname"]=> string(1) "c" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
69.35 ms | 401 KiB | 8 Q