Reply to Re: stdClass Object - get_object_vars

Your name:

Reply:


Posted by Janwillem Borleffs on 09/05/05 22:57

juglesh wrote:
> hello, i have a d/l'd class that gives an array which prints like
> this:
>
> stdClass Object
> (
>

This is not an array, but an object

> i cannot seem to access the values using
> $thearray['first name']['inputtype']
>

This works for arrays For objects, you should do this as follows:

$theobject->{'first name'}->inputtype;

Note that I used curly braces here because 'first name' contains a space
character.

If this wasn't the case, you could do it like this:

$theobject->firstname->inputtype;

> Here is the class, oh, and maybe someone can see why it's putting two
> end brackets on the [first name]], etc.
>
[...]
> // section
> if ((substr($data, 0, 1) == '[') AND (substr($data, -1) == ']')) {
> $this->_last_section = substr($data, 1, (strlen($data) - 1));
> return;
> }
>

$this->_last_section = substr($data, 1, - 1);

BTW, you should also take a look at the parse_ini_file function:

http://www.php.net/manual/en/function.parse-ini-file.php


JW

[Back to original 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

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