php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59 $this keyword parser error
Submitted: 1998-02-11 23:38 UTC Modified: 1998-02-12 00:19 UTC
From: jon at clearink dot com Assigned:
Status: Closed Package: Parser error
PHP Version: 3.0b4 OS: solaris 2.5.1
Private report: No CVE-ID: None
 [1998-02-11 23:38 UTC] jon at clearink dot com
referencing a variable which is a string by the $this within a string doesn't work.

$qry = "UPDATE visits SET timeout=Now(), WHERE sessionid='$this->$sid'";

if i do this, it works:

$sid = $this->$sid;
$qry = "UPDATE visits SET timeout=Now(), WHERE sessionid='$sid'";

the parser error is:

Parse error: parse error, expecting `STRING' in includes/functions.inc on line 89

$sid is declared at the top of the class as:

var $sid="";

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-02-12 00:19 UTC] rasmus
Not a bug, typo in script.

  $sid = $this->$sid  should be $sid=$this->sid
 [2020-03-10 20:52 UTC] nikic@php.net
Automatic comment from SVN on behalf of nikic
Revision: http://svn.php.net/viewvc/?view=revision&revision=349373
Log: Added changelog documentation to mb_convert_case()

Patch by thg2k.

Closes php/doc-en#59.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Oct 15 10:01:27 2024 UTC