3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // Everything you enter here will be executed by our servers. Try it! $q1 = 1; $q2 = 2; $q3 = 3; $q4 = 4; $q5 = 5; echo "${q1}"; //outputs 1 for($i=1; $i<=5; $i++) { echo "$q{${i}}"; //how to make $i work here? }
Output for hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
1 Notice: Use of undefined constant i - assumed 'i' in /in/mXhJM on line 14 Notice: Undefined variable: q in /in/mXhJM on line 14 1 Notice: Use of undefined constant i - assumed 'i' in /in/mXhJM on line 14 Notice: Undefined variable: q in /in/mXhJM on line 14 2 Notice: Use of undefined constant i - assumed 'i' in /in/mXhJM on line 14 Notice: Undefined variable: q in /in/mXhJM on line 14 3 Notice: Use of undefined constant i - assumed 'i' in /in/mXhJM on line 14 Notice: Undefined variable: q in /in/mXhJM on line 14 4 Notice: Use of undefined constant i - assumed 'i' in /in/mXhJM on line 14 Notice: Undefined variable: q in /in/mXhJM on line 14 5
Output for 5.0.4 - 5.6.28
1 Notice: Undefined variable: q in /in/mXhJM on line 14 Notice: Use of undefined constant i - assumed 'i' in /in/mXhJM on line 14 1 Notice: Undefined variable: q in /in/mXhJM on line 14 Notice: Use of undefined constant i - assumed 'i' in /in/mXhJM on line 14 2 Notice: Undefined variable: q in /in/mXhJM on line 14 Notice: Use of undefined constant i - assumed 'i' in /in/mXhJM on line 14 3 Notice: Undefined variable: q in /in/mXhJM on line 14 Notice: Use of undefined constant i - assumed 'i' in /in/mXhJM on line 14 4 Notice: Undefined variable: q in /in/mXhJM on line 14 Notice: Use of undefined constant i - assumed 'i' in /in/mXhJM on line 14 5
Output for 4.3.0 - 5.0.3
1 Notice: Undefined variable: q in /in/mXhJM on line 14 Notice: Use of undefined constant i - assumed 'i' in /in/mXhJM on line 14 1 Notice: Undefined variable: q in /in/mXhJM on line 14 Notice: Use of undefined constant i - assumed 'i' in /in/mXhJM on line 14 2 Notice: Undefined variable: q in /in/mXhJM on line 14 Notice: Use of undefined constant i - assumed 'i' in /in/mXhJM on line 14 3 Notice: Undefined variable: q in /in/mXhJM on line 14 Notice: Use of undefined constant i - assumed 'i' in /in/mXhJM on line 14 4 Notice: Undefined variable: q in /in/mXhJM on line 14 Notice: Use of undefined constant i - assumed 'i' in /in/mXhJM on line 14 5