On 22 Dec 2012 at 16:50, Tedd Sperling <tedd@xxxxxxxxxxxx> wrote: > On Dec 21, 2012, at 8:06 PM, Jim Giner <jim.giner@xxxxxxxxxxxxxxxxxx> wrote: >>> That actually makes sense tho. Afterall, a string is truly only one memory >>> allocation whereas array elements are basically multiple vars having the >>> same name. So - how can you unset one char in a string? > > It depends upon the language -- while it is true that the start of a string is > located at a memory address, the chars of the string are identical to the > chars in an array. As such, you can view a string as an array. Each index is > representative of a char (one byte) in the string. That is explicitly documented here: <http://php.net/manual/en/language.types.string.php> String access and modification by character Characters within strings may be accessed and modified by specifying the zero-based offset of the desired character after the string using square array brackets, as in $str[42]. Think of a string as an array of characters for this purpose. The functions substr() and substr_replace() can be used when you want to extract or replace more than 1 character. -- Cheers -- Tim
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php