Re: PHP 4 OOP, re-using a object?
| From: | Curt Zirzow | Date: | Mon, 11 Sep 2006 20:26:45 +0000 |
| Subject: | Re: PHP 4 OOP, re-using a object? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-241624@lists.php.net to get a copy of this message | ||
On 9/10/06, Micky Hulse <micky@ambiguism.com> wrote:
Christopher Weldon wrote:
What's the error, and how do you have the class and functions defined?
Hi Christopher, thanks for asking. :)
Actually, it was one of those silly, right in front of my face, logic
errors...
class RandomSplash {
var $alphabet = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
'k', 'l', 'm');
function randomize($what) {
switch($what) {
case 'css':
$data = $this->$alphabet;
...
...
...
}
}
See the error?
For future reference it is best you provide a full code example in
what your problem is when you ask the question, Asking if it something
is proper isn't going to get you far.
<?php echo $am_somevar; ?>
is perfectly valid but accoring to the mistake you had you should have
been using:
<?php echo $I_am_somevar;?>
It would have been more relevant to supply the problem along with the solution.
$data = $this->$alphabet; should've been: $data = $this->alphabet; At first I thought it was how I was calling the class... all works now though. :)Good to hear you got it resolved.. Curt.