You are here: Re: Accessing properties via vars « PHP Language « IT news, forums, messages
Re: Accessing properties via vars

Posted by Flibble on 11/21/65 11:24

"Janwillem Borleffs" <jw@jwscripts.com> wrote in news:4307b00b$0$6827
$dbd4d001@news.euronet.nl:

> Flibble wrote:
>> If you look at the property $updatedFields it should end up populated
>> with two elements, "Name" & "Age". However they are populated with
>> zero values.
>> The curious thing is that inside the __set function the property has
>> the correct values in it, as soon as it moves outside the method they
>> are zero.....Can't see why it is doing this (might be code blind by
>> now though :( )
>>
>
> On my machine, a print_r on $updateFields produces:
>
> Array
> (
> [0] => Name
> [1] => Age
> )
>
> and a print_r on $itemArray produces:
>
> Array
> (
> [Name] => Me
> [Age] => 30
> )
>
> So your class appears to work as it should.
>
>
> JW
>
>
>
>

Hmm. curious

The strange thing I have here is that I added the following after the
class to display the output (I also added a getItemArray() method to
return the data array).

echo "fields Updated -><pre>";
print_r( $obj->getUpdatedFields() );
echo "</pre>data -> <pre>";
print_r( $obj->getItemArray() );
echo "</pre>

If I run it in a normal browser it just outputs a single zero....If
however I step through debug (Using Zend Studio) it displayes the
output...but the $updateFields are still blank, whilst the $itemArray is
populated correctly...


I starte changing lines around and the offending item seems to be in the
setArray() method

$this->$property = $array[$property];

If I change this (for test purposes) to:

$this->testItem = $array[$property];

Everything works perfectly as it should...As soon as I put a variable in
there its almost like it halts the script from running.

May I ask what OS your server is running on? Mine is Fedora Core 3..maybe
it is OS related?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация