You could also use the x operator (repetition):
$bin = "\0" x (4 * ($last_val+1));
A benchmark would have to show whether it's more efficient, though...
In reply to Re: Fast string construction
by Eliya
in thread Fast string construction
by citromatik
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |