Reply to Re: What is the difference between "=>" and "->" operators?

Your name:

Reply:


Posted by Ulf Kadner on 08/13/07 11:53

mejpark wrote:
> Morning,

Good? :-x


> <?php
> class Dealer extends AppModel
> {
> var $name = 'Dealer';
> var $hasMany = array ('Product' => array(
> 'className' => 'Product',
> 'conditions'=>,
> 'order'=>,

you forget do define the value, assigned to array keys 'conditions' and
'order'

> Eclipse produces an error underneath the comma directly after the
> 'conditions' field, which says:
> "Parse error: "Static/scalar constant expected.""

thats it, yes

> <?php
> class Dealer extends AppModel
> {
> var $name = 'Dealer';
> var $hasMany = array (
> "Product" =>
> array("className","Product","conditions","order","foreignKey","dealer_id"));

Its usually not the same.
You are using now a numeric indicated array and not the required
associative array format.

You must read the documentation about arrays for understanding:
http://www.php.net/manual/en/language.types.array.php

> What is the difference between " => " and " -> " in PHP?

=> is only usable in array context. (see Array-Doc)

-> is to call some class sensitive Elements (e.g. Methods, Fields)
access only non static Elements

for accessing static class elements use the double colon ::

So Long. Ulf

[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

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