Does anyone know why when I execute this :
#!/usr/bin/php
<?php
$eff_theo = array_fill(0, 10, 100);
for ($i = 0; $i < 10; ++$i)
echo printf("%5d", $eff_theo[$i]).' ';
echo PHP_EOL;
?>
I get this :
1005 1005 1005 1005 1005 1005 ...
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’re mixing
echoandprintf.printfreturns the length of the formatted string, so yourechocall is printing out ‘5’.Try removing the
echoand try it again….