PHP 8.5.0 Alpha 1 available for testing

Voting

: six plus two?
(Example: nine)

The Note You're Voting On

Andrew dot Wright at spamsux dot atnf dot csiro dot au
23 years ago
An error in my last example:
$b = sprintf("%30.s", $a);
will only add enough spaces before $a to pad the spaces + strlen($a) to 30 places.

My method of centering fixed text in a 72 character width space is:

$a = "Some string here";
$lwidth = 36; // 72/2
$b = sprintf("%".($lwidth + round(strlen($a)/2)).".s", $a);

<< Back to user notes page

To Top