Assigning to $this

This is a discussion on "Assigning to $this" within the PHP Forum section. This forum, and the thread "Assigning to $this are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jul 9th, 2007, 12:59
Junior Member
Join Date: Jul 2006
Location: Maine
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Assigning to $this

In making the switch from 4 to 5, this is the only problem I have run into so far. Throws me an error, cannot re-assign $this. What do I do?
Reply With Quote

  #2 (permalink)  
Old Jul 9th, 2007, 13:16
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Assigning to $this

How about showing us some code?!
Reply With Quote
  #3 (permalink)  
Old Jul 9th, 2007, 14:41
Junior Member
Join Date: Jul 2006
Location: Maine
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Assigning to $this

PHP: Select all

$this str_replace(""""$PHP_SELF); // Define this page for other functions 

Reply With Quote
  #4 (permalink)  
Old Jul 9th, 2007, 15:17
c010depunkk's Avatar
SuperMember

SuperMember
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to c010depunkk
Re: Assigning to $this

Quote:
Originally Posted by Maverick25r View Post
cannot re-assign $this
Sounds like the $this variable is read-only or a constant.
Reply With Quote
  #5 (permalink)  
Old Jul 12th, 2007, 00:04
Up'n'Coming Member
Join Date: Sep 2006
Location: UK
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Assigning to $this

$this is used to access variables or functions within the current class.
Basically, it's a word reserved for OOP, hence you can't assign it as a variable name.
Reply With Quote
Reply

Tags
this php4 php5

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Assigning "names" to dynamically created Sprites DocBoy52 Flash & Multimedia Forum 1 Nov 23rd, 2007 15:54
Assigning a value to Hidden Type. thanawala84 Web Page Design 1 Oct 13th, 2007 08:10


All times are GMT. The time now is 07:37.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43