3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public const PATH_TO_FILES = __DIR_.'../dpm/oc-content/uploads/28/'; public function __construct() { $item = $this->itemResolver(); $imageThumbNailsPath = []; $imagePreviewPath = []; foreach(iterator_to_array($item,true) as $field){ $thumbNailsPath = sprintf('%s_thumbnail.jpg',$field); $previewsPath = sprintf('%s__preview.jpg',$field); } var_dump($imagePreviewPath); var_dump($imageThumbNailsPath); } public function itemResolver(): \Generator { // $stmt = mysqli_query($db_connect, "select pk_i_id from oc_t_item_resource ORDER by pk_i_id desc"); // $records = mysqli_fetch_all($stmt); $records = [ 0 => [0 => '4031'], 1 => [0 => '4030'], 2 => [0 => '4029'] ]; foreach($records as $record => $value){ yield $value; } } } var_dump(new Test());
Output for git.master, git.master_jit
Fatal error: Uncaught Error: Undefined constant "__DIR_" in /in/8knp2:41 Stack trace: #0 {main} thrown in /in/8knp2 on line 41
Process exited with code 255.
Output for rfc.property-hooks
Fatal error: Uncaught Error: Undefined constant "__DIR_" in /in/8knp2:4 Stack trace: #0 /in/8knp2(41): [constant expression]() #1 {main} thrown in /in/8knp2 on line 4
Process exited with code 255.

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:
62.17 ms | 401 KiB | 8 Q