You are here: Re: what does "->" and "=>" do? « PHP Programming Language « IT news, forums, messages
Re: what does "->" and "=>" do?

Posted by thaertel on 05/17/07 04:26

On May 16, 4:55 pm, planetbr...@gmail.com wrote:
> I have read through php.net manuals and have not see any mention about
> what these operands actually do. I have seen them used in a bunch of
> different code lately and don't really understand.
>
> Example 1:
>
> // Legacy Function: Renders the Footer of the Theme
> function themefooter() {
> global $engine, $index, $themepath;
>
> if ($index != 3) {
> $engine->do_themefooter($index);
> }
>
> }
>
> Example 2:
>
> // get the color scheme
> $colors = pnModAPIFunc('Xanthia','user','getSkinColors',
> array('skinid' => $skinID,
> 'paletteid' => $paletteid));
>
> If anyone can shed some light on this, it would be greatly
> appreciated.
>
> thanks,
> brett.

Ok brett its pretty simple the difference between the two. In this
particular circumstance the two operators are used for very different
things. Example 1 is a C like operator. Almost like an object in OOP
programming.
$engine is like a pointer to the value do_themefooter($index);
returns. Which is what happens in this sense.

Example 2
This is one of many ways to populate an array in php.
Instead of populating the array with a number based index, They have
chosen to populate the array using names instead of numbers. Ex.
$array[0] = "whatever";
Ex. $array('skinid' => $skinID);
This technique is pretty frequent in certain circumstances. So
$array['skinid'] refers to the value of $skinID.

Hope this was helpful.

Trey

 

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

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