Re: Really basic question
- From: David Haynes <david.haynes2@xxxxxxxxxxxx>
- Date: Fri, 26 May 2006 08:03:19 -0400
alan wrote:
Sorry that this is so simple -
Exactly what does the operator '=>' do?
Why can't I find it in the list of operators in the PHP manual?
And while I'm here, what about '->'? (I can't find that either)
=> is used to assign a value to an element in an array
For example:
$foo = array( 'one' => 1, 'two' => two, 'fred' => 'wilma');
-> is used to reference an element in a class (I use the word 'element' since it may be a function (method) or instance value (variable).
For example:
class Foo {
function splat() {
echo 'splat\n';
}
}
$foo = new Foo();
$foo->splat(); // causes 'splat' to be displayed.
-david-
.
- References:
- Really basic question
- From: alan
- Really basic question
- Prev by Date: Really basic question
- Next by Date: Re: Change font in PHP
- Previous by thread: Really basic question
- Next by thread: How do I download and edit a website?
- Index(es):