|
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]
|