JC99 Posted June 26, 2009 Share Posted June 26, 2009 Hey all, I'm new to these forums and have decided to learn PHP. I have 2 questions. What does => mean? What does -> mean? I bought the book "Programming PHP" published by O'Reilly and was just flipping through it but I can't find the definition of -> and => in the book even though they are used in code examples throughout the book. Can someone explain these two things to me. Thanks Link to comment https://forums.phpfreaks.com/topic/163729-what-do-these-mean/ Share on other sites More sharing options...
Eggzorcist Posted June 26, 2009 Share Posted June 26, 2009 The expression "=>" that's normally used in some-kind of if statement. and it means for example $variable1 => $variable2 which means varriable2 is either equal or less than variable1. The expression "->" looks like object oriented programming to me but I could be wrong. I don't use OOP normally. But in OOP it goes after a variable for example " $variable->status" But I could be wrong but I'm certain about the first one. Link to comment https://forums.phpfreaks.com/topic/163729-what-do-these-mean/#findComment-863938 Share on other sites More sharing options...
MasterACE14 Posted June 26, 2009 Share Posted June 26, 2009 The expression "=>" that's normally used in some-kind of if statement. In a if it is used like >= (equal to or greater than) It is generally used in arrays and loops. $key => $val Link to comment https://forums.phpfreaks.com/topic/163729-what-do-these-mean/#findComment-863940 Share on other sites More sharing options...
JC99 Posted June 26, 2009 Author Share Posted June 26, 2009 I thought "equal to or less than" was <= and that "equal or greater than" was >= I wanted to know about => Link to comment https://forums.phpfreaks.com/topic/163729-what-do-these-mean/#findComment-863942 Share on other sites More sharing options...
Alex Posted June 26, 2009 Share Posted June 26, 2009 I thought "equal to or less than" was <= and that "equal or greater than" was >= I wanted to know about => They pretty much covered it. => in arrays key => value. -> Is used (not only in PHP) as a pointer. Example: class->method(); Link to comment https://forums.phpfreaks.com/topic/163729-what-do-these-mean/#findComment-863944 Share on other sites More sharing options...
JC99 Posted June 26, 2009 Author Share Posted June 26, 2009 I guess I have to read up on arrays and classes. Thanks guys Link to comment https://forums.phpfreaks.com/topic/163729-what-do-these-mean/#findComment-863947 Share on other sites More sharing options...
Alex Posted June 26, 2009 Share Posted June 26, 2009 I guess I have to read up on arrays and classes. Thanks guys Here's a little bit of a better explanation: $array = Array('something' => 'value'); echo $array['something']; // 'value' Key => Value, Key is the name by which you'll be accessing that element of the array. And the value is well, the value of that element. Link to comment https://forums.phpfreaks.com/topic/163729-what-do-these-mean/#findComment-863950 Share on other sites More sharing options...
JC99 Posted June 26, 2009 Author Share Posted June 26, 2009 The expression "=>" that's normally used in some-kind of if statement. and it means for example $variable1 => $variable2 which means varriable2 is either equal or less than variable1. I am a little confused. So does this mean >= and => are interchangeable? Link to comment https://forums.phpfreaks.com/topic/163729-what-do-these-mean/#findComment-863953 Share on other sites More sharing options...
Alex Posted June 26, 2009 Share Posted June 26, 2009 The expression "=>" that's normally used in some-kind of if statement. and it means for example $variable1 => $variable2 which means varriable2 is either equal or less than variable1. I am a little confused. So does this mean >= and => are interchangeable? No, => is used in arrays. >= would be used in a conditional statement. Link to comment https://forums.phpfreaks.com/topic/163729-what-do-these-mean/#findComment-863954 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.