Inserting characters in the a certain position in a string (not array)
Posted 07 July 2006 - 12:16 PM
$str = "12345678";
so at position 8, i would want to insert a '9'.
i've tried str_pad() but it isn't doing the job.
and substr_replace() would work fine IF it didn't actually replace the other charatcers, just inserted them in there.
ps: i just noticed how the title of this thread doesn't make much sense. sorry about that. it's 8:30am and i have yet to sleep.
Posted 07 July 2006 - 12:47 PM
$var = "1234678";
That would then output 12345678
Posted 07 July 2006 - 01:21 PM
I Just actually went to read the manual (function by function in the 'strings' category) until i reached chunk_split() and it seems to work fine so far.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users