3v4l.org

run code in 300+ PHP versions simultaneously
<?php //SUT /** * @param array $personArray * * @return int The number of rows affected. (Should be 1) */ public function addPerson(Array $personArray) { /** @var Doctrine\DBAL\Connection $conn */ $conn = clone $this->conn; $personArray['crew_start_date'] = (new \DateTime($personArray['crew_start_date']))->getTimestamp(); return $conn->transactional(function() use($conn, $personArray){//How do I get code coverage inside this closure? $inputValues = array_merge([ 'crew_given_name' => null, 'crew_family_name' => null, 'crew_start_date' => null, 'crew_end_date' => null, ], $personArray); return $conn->insert('mqiv_crew', $inputValues, [\PDO::PARAM_STR, \PDO::PARAM_STR, \PDO::PARAM_INT, \PDO::PARAM_INT]); }); } //The test public function testCanAddPerson() { $mockDb = clone $this->mockDb; $mockDb->expects($this->any()) ->method('transactional') ->will($this->returnValue(1)); $testConnector = new SqlConnector($mockDb, $this->getMockBuilders()); $testPersonArray = [ 'crew_given_name' => 'testy', 'crew_family_name' => 'testing', 'crew_start_date' => '01/01/2014', 'crew_end_date' => '02/01/2014', ]; $this->assertEquals(1, $testConnector->addPerson($testPersonArray), "Could not add person"); }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.270.0090.03712.36
5.4.260.0070.04112.36
5.4.250.0070.03812.36
5.4.240.0070.03612.36
5.4.230.0060.03812.36
5.4.220.0050.03812.36
5.4.210.0040.03812.35
5.4.200.0080.03912.35
5.4.190.0070.03812.35
5.4.180.0050.03612.35
5.4.170.0070.03512.36
5.4.160.0080.03612.35
5.4.150.0050.03612.35
5.4.140.0070.03612.04
5.4.130.0050.03612.02
5.4.120.0040.03811.98
5.4.110.0070.03811.98
5.4.100.0070.04811.98
5.4.90.0070.05211.98
5.4.80.0050.04511.98
5.4.70.0100.04111.98
5.4.60.0080.03811.97
5.4.50.0060.03611.98
5.4.40.0050.03611.96
5.4.30.0050.03511.96
5.4.20.0040.03811.95
5.4.10.0060.03411.96
5.4.00.0070.03611.46
5.3.280.0070.04412.71
5.3.270.0070.04912.72
5.3.260.0080.04512.72
5.3.250.0090.03712.72
5.3.240.0090.03612.72
5.3.230.0070.03912.71
5.3.220.0070.04212.68
5.3.210.0060.03912.68
5.3.200.0070.04012.68
5.3.190.0080.03812.68
5.3.180.0050.03812.67
5.3.170.0050.03812.67
5.3.160.0060.03812.68
5.3.150.0070.04212.67
5.3.140.0090.04012.66
5.3.130.0090.04512.66
5.3.120.0050.04712.66
5.3.110.0070.04512.66
5.3.100.0070.03812.12
5.3.90.0090.04312.08
5.3.80.0040.03812.07
5.3.70.0090.03812.08
5.3.60.0050.04312.06
5.3.50.0070.05112.00
5.3.40.0070.04512.00
5.3.30.0060.04611.94
5.3.20.0070.05011.70
5.3.10.0080.04311.66
5.3.00.0070.04311.64

preferences:
140.97 ms | 1394 KiB | 7 Q