Giving more than one zero-base index value?

Hi. I tried to use commans (,) or pluses (+) to add more indexes besides 0 in the following code:

<?php
$greeting = "Hello";
$greeting{0} = "J";
echo $greeting;
?>

The word “Hello” turns to “Jellow”… I want it to turn to “JJJJJ”, so I did 0,1,2,3,4 or 0+1+2+3+4, but none helped… How could I effect the whole word?

Thanks,

Try this:

http://php.net/manual/en/function.array-fill.php

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.