/*SRT_PAD function returns the string padded on the left, the right, or both sides to the specified padding length. If the optional argument pad_string is not supplied, the string is padded with spaces, otherwise it is padded with characters from pad_string up to the limit.*/ <?php // Multiplication table for ($h=1; $h<=10; $h++){ for ($v=1; $v<=10; $v++){ if ($v==1){ echo str_pad($v*$h, 2, " ", STR_PAD_LEFT);} else{ echo str_pad($v*$h, 4, " ", STR_PAD_LEFT); } } echo "\n"; } ?>
by Anna Tukvadze
2 years ago
PHP
Multiplication table
0
Pro tip: use ```triple backticks around text``` to write in code fences