3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $results = [ 0 => ['txn' => 1, 'doctype' => 0, 'docid' => 1534098], 1 => ['txn' => 1, 'doctype' => 4, 'docid' => 1545], 2 => ['txn' => 1, 'doctype' => 4, 'docid' => 1098554], 3 => ['txn' => 1, 'doctype' => 5, 'docid' => 1098574], 4 => ['txn' => 1, 'doctype' => 7, 'docid' => 164525], 5 => ['txn' => 1, 'doctype' => 9, 'docid' => 153246], 6 => ['txn' => 1, 'doctype' => 9, 'docid' => 1554], 7 => ['txn' => 1, 'doctype' => 9, 'docid' => 15347], 8 => ['txn' => 1, 'doctype' => 1, 'docid' => 153354], 9 => ['txn' => 1, 'doctype' => 1, 'docid' => 190755], 10 => ['txn' => 2, 'doctype' => 0, 'docid' => 1554], 11 => ['txn' => 2, 'doctype' => 4, 'docid' => 159072], 12 => ['txn' => 2, 'doctype' => 7, 'docid' => 1436527], 13 => ['txn' => 2, 'doctype' => 9, 'docid' => 15647], 14 => ['txn' => 2, 'doctype' => 1, 'docid' => 15745], 15 => ['txn' => 3, 'doctype' => 0, 'docid' => 1576274], 16 => ['txn' => 3, 'doctype' => 2, 'docid' => 15945], 17 => ['txn' => 3, 'doctype' => 4, 'docid' => 15436], 18 => ['txn' => 3, 'doctype' => 5, 'docid' => 108543], 19 => ['txn' => 3, 'doctype' => 5, 'docid' => 91592], 20 => ['txn' => 3, 'doctype' => 1, 'docid' => 15046], 21 => ['txn' => 3, 'doctype' => 1, 'docid' => 109567], 22 => ['txn' => 3, 'doctype' => 1, 'docid' => 1906735] ]; foreach ($results as $row){ $output .= 'Trans: '.$row['txn'].', DocType: '.$row['doctype'].', Doc ID: '.$row['docid']."\n"; } echo $output;
Output for 5.4.0 - 7.1.0
Notice: Undefined variable: output in /in/MFh0n on line 31 Trans: 1, DocType: 0, Doc ID: 1534098 Trans: 1, DocType: 4, Doc ID: 1545 Trans: 1, DocType: 4, Doc ID: 1098554 Trans: 1, DocType: 5, Doc ID: 1098574 Trans: 1, DocType: 7, Doc ID: 164525 Trans: 1, DocType: 9, Doc ID: 153246 Trans: 1, DocType: 9, Doc ID: 1554 Trans: 1, DocType: 9, Doc ID: 15347 Trans: 1, DocType: 1, Doc ID: 153354 Trans: 1, DocType: 1, Doc ID: 190755 Trans: 2, DocType: 0, Doc ID: 1554 Trans: 2, DocType: 4, Doc ID: 159072 Trans: 2, DocType: 7, Doc ID: 1436527 Trans: 2, DocType: 9, Doc ID: 15647 Trans: 2, DocType: 1, Doc ID: 15745 Trans: 3, DocType: 0, Doc ID: 1576274 Trans: 3, DocType: 2, Doc ID: 15945 Trans: 3, DocType: 4, Doc ID: 15436 Trans: 3, DocType: 5, Doc ID: 108543 Trans: 3, DocType: 5, Doc ID: 91592 Trans: 3, DocType: 1, Doc ID: 15046 Trans: 3, DocType: 1, Doc ID: 109567 Trans: 3, DocType: 1, Doc ID: 1906735
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/MFh0n on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/MFh0n on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/MFh0n on line 3
Process exited with code 255.