• Resolved tsalagi

    (@tsalagi)


    Just a quicky that I can’t find any reference to. I’m working on a template and the php code has this syntax in it and I don’t know what it means. What does -> and => do in the following code?

    $getpag[$apage->ID] = $apage->post_title;
    and
    "options" => $styles),
    Thanks in advance

Viewing 1 replies (of 1 total)
  • The -> is object syntax, so $apage->ID is pulling the ID element from the $apage object. If you look at, say, the wpdb object you’ll see the same kind of thing.

    The => is an assignment operator for arrays. You could do something like this:

    $a = array();
    $a['options'] = $styles;
    $a['opt2'] = $hithere;

    But you could also do the same thing like this:

    $a = array('options' => $styles, 'opt2' => $hithere);
Viewing 1 replies (of 1 total)
  • The topic ‘PHP Syntax?’ is closed to new replies.