Why doesn't this work?
| From: | (Ray Van Dolson) | Date: | Sat, 15 Sep 2001 02:13:44 +0000 |
| Subject: | Why doesn't this work? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-67421@lists.php.net to get a copy of this message | ||
I've come across this problem enough that I want to find out if there's a
way to make it work, or if this is just a limitation of PHP. Here's what
I'm trying to do:
print split("=",$testString)[0];
This gives me a syntax error. I've also tried:
print (split("=",$testString))[0];
Along with other permutations... the only way I can get this to work how
I want it to is to create a temporary variable first.
$tempVar = split("=",$testString);
print $tempVar[0];
Now I guess this is easy enough to do, but I'm just used to doing it the
other way. And the documentation for split() says that it should return
an Array... why can't I operate on it as I would a normal array?
Anyways, thanks for any help. I guess I'm just too used to Python. :-D
Ray Van Dolson