php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #198 eregi problem with saving to arrays using an object
Submitted: 1998-03-25 17:17 UTC Modified: 1998-03-28 12:40 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: shano at shano dot com Assigned:
Status: Closed Package: Other
PHP Version: 3.0b6 OS: Win95
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: shano at shano dot com
New email:
PHP Version: OS:

 

 [1998-03-25 17:17 UTC] shano at shano dot com
I'm using the latest PHP that Shane compiled yesterday ..

I have the following code as part of a class I'm working on ..


TEMP is a name, such as "NICK" for example, it finds [NICK], in $this->DATA["TEMPLATE], and SHOULD place it in the array .. But rather, it the aray only contains "Array[0]" ..

When using a global variable in the function using Global $VARIABLE;, the array still contains "Array[0]" ..

However, it works just fine when I pick a new variable not initilized, and not global .. The array contains "[NICK]" ..

Code note working:

if (eregi("\[$this->TEMP\]", $this->DATA["TEMPLATE"], $this->TEMP_A)) { echo "<!-- $this->TEMP_A[0] -->"; }

Above doesn't work ... echos "Array[0]"

if (eregi("\[$this->TEMP\]", $this->DATA["TEMPLATE"], $NEW_ARRAY)) { echo "<!-- $NEW_ARRAY[0] -->"; }

Above works .. echos "[NICK]"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-03-28 12:40 UTC] jim
The problem is that you can't use "$object->member[index]" in a double-quoted string.

If you use 'echo "<!-- " . $this->TEMP_A[0] . " -->"' you will get the results you expect.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 09:01:29 2024 UTC