Forum Moderators: coopster

Message Too Old, No Replies

stupid question

php basics

         

WhosAWhata

5:30 pm on Mar 14, 2004 (gmt 0)

10+ Year Member



I, like many programers, have never had formal training in PHP or any other language. I don't own a book I just use this site and php.net. I've learned a lot by reading code and experimenting, but i'm still missing some basics. can someone give me a link to a tutorial where things like -> and => are explained? these are a few of the things i have been unable to figure out on my own and a google query for "->" returns nothing...
THANKS

slade7

5:47 pm on Mar 14, 2004 (gmt 0)

10+ Year Member



Get this book - it's well worth it. Lots of things are hard to understand on php.net and this book makes it easier to understand - particularly the basics, because much php discussion on the web concerns classes & OOP, which is well beyond the basics.

PHP Bible, 2nd Edition
by Tim Converse (Author), Joyce Park (Author)

[edited by: jatar_k at 6:04 pm (utc) on Mar. 14, 2004]
[edit reason] removed url and inserted title [/edit]

ergophobe

11:22 pm on Mar 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Also, download the windows compiled help files. They let you search for almost anything... I don't know about -> :: and so on.

WhosAWhata

4:46 am on Mar 15, 2004 (gmt 0)

10+ Year Member



thanks, i'll look at those

HelenDev

4:26 pm on Mar 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am in a similar position, WhosAWhata in that I haven't had any formal training in php but pick it up as I go along. So I'm no expert but => is what I usually see when I echo out an array using
print_r($myarray);

As for tutorials, my faves (for php and most other web related stuff) are on the webmonkey site.

ergophobe

4:51 pm on Mar 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Well, I didn't think the original poster wanted specifics, but

-> designates an object member or method. In a class, you declare a new object thus:

$objClass = new myClass($param1, $param2);

Then you access members like this

$objClass->length

and methods like this

$objClass->calculateArea($radius)

=> is used for arrays in many contexts. In general, the values on the two sides are

$key => $value
aka
$associative_index => $value

thus

$myArray = array('color' => 'red', 'size' => 'large')

Tom