473,396 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

what does "->" and "=>" do?

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.

May 16 '07 #1
5 1897
*** pl*********@gmail.com escribió/wrote (16 May 2007 13:55:14 -0700):
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.
->

http://es2.php.net/manual/en/function.array.php

=>

http://es2.php.net/manual/en/language.oop.php

Hope this helps,
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
May 16 '07 #2
On May 16, 3: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);
}

}
The -return the attribute or calls the methods of an object The
above example calls the do_themefooter() method of whatever class
$engine is.
>
Example 2:

// get the color scheme
$colors = pnModAPIFunc('Xanthia','user','getSkinColors',
array('skinid' =$skinID,
'paletteid' =$paletteid));
That's an array. The =means the the string on the right side (the
key) refers to the value on the left. You could access the value of
$skinID, for example like this:
$colors['skinid']
>
If anyone can shed some light on this, it would be greatly
appreciated.

thanks,
brett.

May 17 '07 #3
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

May 17 '07 #4
Message-ID: <11**********************@e65g2000hsc.googlegroups .comfrom
th******@gmail.com contained the following:
Ex. $array('skinid' =$skinID);
This technique is pretty frequent in certain circumstances. So
$array['skinid'] refers to the value of $skinID.
I call it an 'andits' As in

$key andits $value

:-)

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
May 17 '07 #5
thaertel wrote:
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.
It's not "almost like" an object.

It is the operator that allows you to access properties and methods of an
object. It's analogous to the square brackets when using arrays.

$foo['bar'] is to arrays
As $foo->bar is to objects.

Despite looking like a little arrow, it's not got anything to do with
pointers in a C sense of the word. $engine isn't a pointer to the value
do_themefooter($index) returns.

$engine is an object -- a "thing" of some kind, and it has a method
do_themefooter(). A "method" is just "something that an object is capable
of doing". So "$engine->do_themefooter()" just means: ask $engine to
perform its "do_themefooter()" action. Like this:

$dog->chase($cat);

Dog isn't a "pointer to the cat chasing function". Dog is the thing that's
actively doing the chasing.

--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux
May 17 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Derek Fountain | last post by:
The documentation says session_destroy() "destroys all of the data associated with the current session". Um, like what? The docs further say that you should remove all information in the _SESSION...
70
by: Roy Yao | last post by:
Does it mean "(sizeof(int))* (p)" or "sizeof( (int)(*p) )" ? According to my analysis, operator sizeof, (type) and * have the same precedence, and they combine from right to left. Then this...
2
by: Steve Richter | last post by:
What does the "." mean in the following sql script stmts? use GO if exists (select * from dbo.sysobjects where id = object_id(N'.') and OBJECTPROPERTY(id,N'IsUserTable') = 1) drop table ....
2
by: Tom | last post by:
I'm getting this error when I try to pass a structure to a dll. An unhandled exception of type 'System.ArgumentException' occured in Test1.exe Additional Information: Type could not be marshaled...
0
arunmib
by: arunmib | last post by:
Hi all, I have doubt, as what does __declspec (dllimport) or __declspec(dllexport) does? If add these only the functions of a dll are exported or imported right? So what exactly does...
9
by: JoeC | last post by:
m_iWidth = (int)pBitmapInfo->bmiHeader.biWidth; m_iHeight = (int)pBitmapInfo->bmiHeader.biHeight; What does this mean? I have seen v=&var->member.thing; but what does it mean when you...
92
by: Heinrich Pumpernickel | last post by:
what does this warning mean ? #include <stdio.h> int main() { long l = 100; printf("l is %li\n", l * 10L);
9
by: James Dow Allen | last post by:
How about this idea? Post fragments of C code which seem fun, interesting or instructive. Puzzles can be posed in various ways. (What does this do? Can you see the bug? How to code this for...
3
by: qianz99 | last post by:
Hi I am not sure what this code does. I have the following questions 1. where is the case? 2. #define TLV_INTEGER(name, octets) p->name = -1; Is it define a function TLV_INTEGER(name, octets) ...
2
by: Lambda | last post by:
The code is simple: // Token.h #ifndef TOKEN_H #define TOKEN_H #include <vector> #include <string> class Token
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.