By Kevin Yank

What do you call this: =>

By Kevin Yank

As languages go, PHP has more syntactic sugar than some. Esoteric constructs like list(…) are all over the place, making developers’ jobs easier, but tripping up beginners at the same time.

A particularly useful construct is the foreach loop, which provides a quick way to loop through an array (or, as of PHP5, an object):

$arr = array(1, 2, 3, 4);
foreach ($arr as &$value) {
   $value = $value * 2;

With associative arrays, you can get both the key and value of each item in the array with a little of the aforementioned syntactic sugar:

$a = array(
   "one" => 1,
   "two" => 2,
   "three" => 3,
   "seventeen" => 17

foreach ($a as $k => $v) {
   echo "$k => $vn";

Okay, so if you code PHP regularly I probably haven’t told you anything you don’t already know. But here’s the twist: what do you call the => operator in that last code sample? C’mon — it must have a name, right? As it turns out, no official name is documented in the PHP manual… so what do you call it?

Reportedly it’s called the “double arrow” in the source code to PHP, but that’s only slightly better than “that little arrowey thing.” What do you think it should be called?

  • Hehe, true, it doesn’t have a name. You don’t name it, you just use it daily… Need suggestions? OK.

    A bolt? :D
    A shaft?

    OK, a “flash”. For one, it sounds somewhat close to the French for arrow, “flêche” (but is better than “flesh”). And then it allows you to quickly navigate an array, right, in a blink of an eye, in a flash.

  • mmj

    It’s an arrowhead :)

  • Most of the times i call it simplifier because it makes navigating through an array a lot simpler. :)

  • Maybe gets?

    As in “$key gets $value”.


  • Richard

    Call it Bob.

  • patrikG

    array assigner

  • Vikrant

    Key Seperator

  • What is the Hebrew for “double arrow”?

  • pravin

    How about “access pointer”?

  • cholmon

    I’ve taken to calling it “arrow”, but a single-syllable alternative would be welcome.

    On a similar note, what do you call “->”? I’m sure it’s got it’s official name, but if you were reading this out loud:


    how would it sound?

  • Etnu

    Spear of Destiny.

  • ronanmagee

    I just call it a pointer, as in $k points to (=>) $v

  • chris ward

    It’s a pointer, syntax taken from C/C++ I believe

  • pravin

    Yes. Right. That’s why I said “Access Pointer”. As “->” this is pointer.
    Using “=>” we access the element of array. Hence “Access Pointer”

  • Do we need to call it anything? If so I’d say The Associator for obvious reasons.
    Failing that I suggest ted.

  • devonmallory

    Can it not be called => like Prince used to be?

  • auricle

    Derick Rethans just savaged this;

    Over in the PHP Application Design forum, we’re wondering what happen to PHPPatterns.

    Another reason for bemoaning Harry’s disappearance.

  • Tvienti

    Dinamegatron Maxipowerbar operator

  • I agree that this post is kinda pointless.


    – association operator
    – tuple operator
    – mapping operator
    – index operator
    – hash operator
    – etc.


    Maybe “wang“, a la Penny Arcade.

    Or perhaps “squid”.
    If you rotate it counter-clockwise, “house” would work.
    I like the “dart” suggestion above, too.

    Seriously, though, what it does is associate one thing with another, so why not call it an “associator“, or a “relation“?

  • TheLunchBox

    I like the name Bob or possibly shmoopy

    Maybe even combine the two SHMOOBOB!

  • Buddha443556

    In Perl, it’s known as the arrow comma.

  • Itshim

    I personally like cranial-bore’s “The Associator”.

    To the people complaining about the blog content:
    Dam man, can you never have a little fun. I have never seen a group of people complain about everything. When it is something a light hearted there are a bunch of complaints about substance. If the blog is about some actual PHP technique, or code, then all the posts are about how wrong the author is. Very rarely can there be an actual debate, without it becoming offensive.

    Yeah we all liked Hary, but complaining that he is no longer around does no good.

    I apologize for this post, I am just really tired of this type of thing…

  • Transpyre

    liking “dart”
    nice & simple.

  • Itshim: I like fun when it’s funny but this could’ve been a non-funny post scriptum for a regular blogpost.

    My point is: Give anyone of the readers a chance to publish some smart concept, idea or comment and it’d end up more interesting than the last five blogposts. I would have enough up my sleeve for my part.

  • Can it not be called => like Prince used to be?

    The symbol formerly known as “double quote”.

  • Well said Itshim. Sometimes you just have to have a bit of fun.

    For those complaining about the content of this blog, how about you stop critising the authors for a change and actually make some useful suggestions about the content you want to read about? The reason Andrew’s blog does so well is because people ask him to blog about certain topics, and he does. I’m sure the PHP bloggers here would be more than willing to comply with requests for content.

    There is always an alternative, that you put up your own hand to write articles or blog content yourself for this community.

    That said, I would have considered this post a valid question. As Kevin mentioned, its not documented what to call it, yet there are names given to :: like “Scope Resolution Operator” (like anyone could remember what its original hebrew name was). I spend a good portion of my day teaching others how to code in PHP, and it can be quite frustrating having to constantly refer to “the arrow thingy”. I guess based on the name change for ::, logic would probably call it the “Index Association Operator”.

  • If you do not have anything to say… [ Tuesday, 27th of September, 2005 – 13:37 – Skien, Norway ]

    then say nothing at all. Am I the only one who things that blog posts like this are only there to be a blog post? This site used to have a nice PHP blog but lately the entries that appear have no content whatsoever. Really sad to see this happening again.

    Seems a bit ironic to me. Derek blogging on how pointless a blog post is, seems pretty pointless to me.

    Anyways… Kevin raises a good point here. It has no documented name :)

  • Expanding on the dart suggestion, I vote for “Dart of Pleasure”.

  • auricle

    >Derek blogging on how pointless a blog post is, seems pretty pointless to me.

    Sure and it’s his blog which he can do with as he likes. So can Sitepoint, but I would have thought that Mr Yank and his colleagues were aiming somewhat higher than vanity publishing.

  • Anonymous

    The programmers who created => ought to have named it! They saw into the future people writing long blog posts about its name, therefore left it open for good humor. ;-)

    I generally refer to it as “the array arrow” or “associative arrow” among coworkers.

  • Elliot Anderson

    I call it an accessor

  • Steve

    Using Google’s or Altavista Bablefish’s translator function you get the following if you use : “equaliser arrow”

    English to German : Entzerrerpfeil
    English to Italian : freccia del compensatore
    English to French : flèche d’égaliseur
    English to Greek : βέλος εξισωτών
    English to Russian : стрелка выравнивателя

    Some of these have a ring to them …

  • llook

    I call it “rovná se větší než”, it means “equals to greater than” in English. But arrow or dart would be better.

  • Let’s call it Dominic :)

  • Great post and creat comments guys :tup:
    I’d call this thing “is”. It’s short and this way the code can be read ok:
    [code]"one" is 1,
    "two" is 2, etc..
    foreach ($a as $k is $v) {

  • TheLunchBox

    I’m going to revise my previous reccomendation of “Shmoobob” to “+6 Vorpal Dart of Associating”

  • though it is recommed to use
    coz it don’t copy the array before extracting

    while(list($key, $value) = each($array)) {


    how about “::” (double double dot? :))

  • RuinDweller

    What is the Hebrew for “double arrow”?

    HaChetz HaKaful. ;) And now try and say it backwords.

  • tombr

    arrow thinggy

  • SchizoDuckie

    Has nobody ever encountered the

    Parse error: parse error, unexpected T_PAAMAYIM_NEKUDOTAYIM


    ( PAAMAYIM_NEKUDOTAYIM == :: a.k.a. double colon )
    It comes from hebrew, and means double colon in hebrew.

    I suggest something similar for =>

  • Kevin Lehman

    Array Simplifier

  • Luke

    Double arrow. I call the -> a single arrow.

  • Luke

    Ok, I solved it! Run this code ?> and you get:

    Parse error: parse error, unexpected T_DOUBLE_ARROW

    So there you have it folks. A T-Double-Arrow or double arrow for short. I was right and you were all wrong. Bwaaaa!!!

  • Luke

    Er, the code was [?php => ?] (replace the [] with angle brackets)

  • It’s just the “equals and larget than sign” operator.. What I mean is, it doesn’t have a name, so I use a descriptive one describing what it is made of, instead of what it does…

  • redbone

    Shouldn’t you be checking the Perl manual? Perl used it for associative arrays first

  • Scheisskopf

    Call it Hitler.

  • sodster

    does it make coffee?

  • Scheisskopf

    No, but then again i don’t Hitler did either. Tell you what, let’s call it ASP.

  • Monkeyhead

    i vote for Jipper

  • Mc P.

    Call it “quitschiboo”

  • AC

    When I was first learning Perl, my professor referred to ‘=>’ and the ‘rocket ship operator’. I’ve always liked that.

  • GC

    $k => $vn

    $k says, “Gimme all your value(able)s! or I’ll tell the compiler!” to $v

    Captain is the rank (post) of all php patterns.

    ” => “ is called JackSparrow! (note, the spaces are part of the pattern :)
    [“=>” would be just sparrow..]

    I call it Captain JackSparrow

  • Pingback: SitePoint Blogs » Dynamically Typed’s New Contributor()

Get the latest in Front-end, once a week, for free.