3v4l.org

run code in 300+ PHP versions simultaneously
<?php $in = "0 0 0 0 0.5230792 0 0 0 0.4769208 0 0 0 "; $data = preg_split("/[\s\n]/",$in); $count = count($in); $length = 1000; $size = $length/$count; $height = 100; print "<svg width='$length' height='$height'>"; $x = 0; foreach ($data as $line) { $inte = floor($line*255); print "<rect x='$x' y='0' width='$size' height='$height' style='fill:rgb($inte,$inte,$inte);stroke-width:1;stroke:white' />"; $x = $x+$size; } print "</svg>"; ?>

preferences:
58.31 ms | 402 KiB | 5 Q