0

Possible Duplicates:
What does “=>” mean in PHP?
Reference - What does this symbol mean in PHP?

Check this: var $hasAndBelongsToMany => array('Member' => 'User'); What does the sign => mean? the second one I know, but what is the first =>?

I saw it in the cakePhp manual.

Link add: http://book.cakephp.org/view/1039/Associations-Linking-Models-Together#

Community
  • 1
  • 1
yossi
  • 3,090
  • 7
  • 45
  • 65
  • Where's the link to the CakePHP documentation page where you saw it? So that we could see the context. – Arvin Feb 02 '11 at 10:32
  • have you tried to use the SQ-search before askig this? http://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php - doesn't this solve you problem? – oezi Feb 02 '11 at 10:33
  • 2
    I don't think this is a duplicate. He is is acking whether => has any other meaning than array item assignment. – Matěj Zábský Feb 02 '11 at 10:34
  • This is *not* an exact duplicate of that question. This operator is in the CakePHP documentation here http://book.cakephp.org/view/1040/Relationship-Types and I have no idea what it means, I suspect it has a CakePHP-specific meaning. – ZoFreX Feb 02 '11 at 10:39
  • It's not a duplicate, pity that it was closed before you actually understood the question.. – yossi Feb 02 '11 at 10:41
  • I renamed the title in the hopes that others will catch on and reopen ;) – David Tang Feb 02 '11 at 10:42
  • To answer your question: No there is no other meaning for `=>`. It's invalid syntax, used in the documentation for illustrative purposes. (Or just a typo like the answers say.) – mario Feb 02 '11 at 10:56
  • just copy the class into a file and run `php -l filename.php` on that file to lint it and you'll see it gives a `syntax error, unexpected '=>', expecting ',' or ';'`. Any decent IDE will also mark this as a syntax error. There is no need to reopen that question. Typos in the CakePHP manual are too localized. The only other use of `=>` is in `foreach` loops and that's already linked in the reference topic. – Gordon Feb 02 '11 at 11:02
  • It's a typo. Compare it to the other associations. – Leo Feb 02 '11 at 11:08
  • Got it all. thanks. and tho i agree that it shouldn't be reopened , i think that it was closed long before they read it at all. not a way to do things. and again, thanks all! – yossi Feb 02 '11 at 11:49
  • @yossi - in some ways it *is* a duplicate, in that people have linked you to *what `=>` means*; the fact that it doesn't mean anything in your context (it is invalid) fully supports this. – Marc Gravell Feb 03 '11 at 14:03

3 Answers3

3

It looks like an mistake.
$var assignments are with a singe '=', that '>' shouldn't be there. It produces an parse error.

gnur
  • 4,671
  • 2
  • 20
  • 33
  • Yepp seems like a mistake - the official manual got it right http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM – Flatlin3 Feb 02 '11 at 10:34
  • 1
    Official manual contains the text provided by OP. "var $hasAndBelongsToMany => array('Member' => 'User');" found in Cake PHP manual here: http://book.cakephp.org/view/1040/Relationship-Types – ZoFreX Feb 02 '11 at 10:38
0

Honestly, it looks like a typo. I found the CakePHP manual and only find instances of $hasAndBelongsToMany = array(..., not => array.

Dan Grossman
  • 51,866
  • 10
  • 112
  • 101