3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 7 => 'a1455656400,96.64,96.85,94.61,95.02,47490678', 8 => '1,98.12,98.21,96.15,96.67,44390173' ]; $date = new \DateTime('now'); $date->format('U = Y-m-d H:i:s'); $quotations = []; for ($i = 7; $i < 9; $i++) { $matches = []; if (preg_match('/^a?(\d+),(\d+\.\d+),(\d+\.\d+),(\d+\.\d+),(\d+\.\d+),(\d+)$/', $array[$i], $matches)) { if (preg_match('/^a(\d+)/', $array[$i])) { $timestamp = $matches[1]; $date->setTimestamp($timestamp); } else { $date->modify("+{$matches[1]} day"); $timestamp = "NULL"; } $quotations[] = [ 'date' => $date, 't' => $timestamp ]; } } var_dump($quotations);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> array(2) { ["date"]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-02-17 22:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ["t"]=> string(10) "1455656400" } [1]=> array(2) { ["date"]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-02-17 22:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ["t"]=> string(4) "NULL" } }

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:
21.75 ms | 402 KiB | 8 Q