You are here: Re: [PHP] problems using chr() in an Object « PHP « IT news, forums, messages
Re: [PHP] problems using chr() in an Object

Posted by Jochem Maas on 04/28/05 15:42

Martín Marqués wrote:
> I have an object class in which I'm doing chr() calls, especifically in the
> definition of some variables, and when loading the class I get this error:
>
> Parse error: parse error, unexpected '(', expecting ',' or ';' in Ticket.inc
> on line 51
>
> Line 51 has:
>
> var $textoInicio = chr(27) . chr(64);

you can only assign 'basic' values (types) to vars in the class definition
(so no function calls) . e.g:

class T
{
var $a = 'a';
var $b = 2;
var $c = array('whatisthis' => 'er?');
var $d = false;
}

what you want to do should be done in the constructor (aka ctor)

class T
{
var $textInicio;

/* ctor -
* if you're using php5 you should call this function __construct()
*/
function T()
{
$this->textInicio = chr(27) . chr(64);
// etc
}
}

>
> If I eliminate all the lines that initializa text variables with chr()
> everything works OK, else I get these errors.
>
> Any idea on whey this is happening?
>

yes! hopefully you do to now :-)

 

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

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