3v4l.org

run code in 300+ PHP versions simultaneously
<?php $precio_1 = 100.00; $precio_2 = 150.00; $precio_3 = 231.50; $precio_4 = 458.44; $precio_5 = 123.15; for($i=1;$i<=5;$i++) { //Here I want to do the macrosustitution. $p = 'precio_'.$i; $precio = $$p; // use a named variable ?> <label>Precio <?php echo $i;?></label> <input type="text" name="<?php echo $precio; ?>" value="<?php echo $precio; ?>"/> <?php } ?>
Output for git.master, git.master_jit, rfc.property-hooks
<label>Precio 1</label> <input type="text" name="100" value="100"/> <label>Precio 2</label> <input type="text" name="150" value="150"/> <label>Precio 3</label> <input type="text" name="231.5" value="231.5"/> <label>Precio 4</label> <input type="text" name="458.44" value="458.44"/> <label>Precio 5</label> <input type="text" name="123.15" value="123.15"/>

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