Re: Strange hidden string to array conversion
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Sun, 04 Jan 2009 16:01:29 -0500
ScriptKid wrote:
Hugh Oxford pisze:So what are you trying to achieve with $s[4] = 'A'?
AFAIK, doing that will create an array, and set the fifth element to 'A'.
No, I'm trying to achieve
$s == ' A';
by writing:
$s = '';
$s [4] = 'A';
which should be possible according to documentation, but as Curtis wrote
(thanks, Curtis!) array conversion is chosen over string padding.
Sad, but true.
I don't see where the documentation says you can do that. The doc specifies "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]. ".
So you can access characters in the string, but it says nothing about being able to access characters which don't exist.
If you want it equal to ' A', then set it to ' A'.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- References:
- Re: Strange hidden string to array conversion
- From: Mathieu Maes
- Re: Strange hidden string to array conversion
- From: Hugh Oxford
- Re: Strange hidden string to array conversion
- Prev by Date: eigenheimzulage kinder,immobilienfinanzierung wie,immobilien kredit vergleich,eigenheimzulage wohnung,immobilienkredit trotz schufa,hypothek konditionen,bauspardarlehen wie,immobilienkredit zinsvergleich,
- Next by Date: Re: email form injection
- Previous by thread: Re: Strange hidden string to array conversion
- Next by thread: Re: Strange hidden string to array conversion
- Index(es):
Relevant Pages
|