$_

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TekWiz

    #1

    $_

    Note: I've tried searching for this in the PHP docs, but I can't figure
    out how to make it search for the dollar sign; it simply ignores it.

    I remember seeing the variable $_ used in some applications. Is this a
    variable that is "special" in PHP, or do people actually define this
    cryptic thing?

    Also, how can this be of use to me?

    And one last thing: How do I search (on Google or any other search
    engine for that matter) with special characters. If I put in "$_ +PHP"
    in Google, it gives very odd results, which leads me to believe that it
    ignores special characters such as $ and &.

    Thanks,
    TekWiz

  • Andy Hassall

    #2
    Re: $_

    On 25 Feb 2005 11:40:06 -0800, "TekWiz" <tekwiz@twarlic k.net> wrote:
    [color=blue]
    >Note: I've tried searching for this in the PHP docs, but I can't figure
    >out how to make it search for the dollar sign; it simply ignores it.
    >
    >I remember seeing the variable $_ used in some applications. Is this a
    >variable that is "special" in PHP, or do people actually define this
    >cryptic thing?[/color]

    It's not special in PHP. It is in Perl, where $_ is the default input and
    pattern-searching space.
    [color=blue]
    >Also, how can this be of use to me?[/color]

    There's nothing special about it in PHP so it's just a cryptic variable name.

    --
    Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
    <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

    Comment

    • cyberhorse

      #3
      Re: $_

      Some special variables, like $_POST, $_GET, $_REQUEST, $_SESSION,
      $_SERVER, $_GLOBAL start with $_. These variable arrays are defined and
      populated by PHP itself ... otherwise the $_ is not significant in any
      way. All variables start with a dollarsign as you probably know though,
      so to seach for a string with a $, you have to be careful. You have one
      of two options - use single quotes (' ') to define the strings you are
      searching for - that way it won't process them further to try to expand
      them with variable values, or to escape the dollarsign, I think with \$
      so instead of searching for $, you will be searching for \$ ... I hope
      that makes sense

      Comment

      Working...