$_

This is a discussion on $_ within the PHP Language forums, part of the PHP Programming Forums category; Note: I've tried searching for this in the PHP docs, but I can't figure out how to make ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-25-2005
TekWiz
 
Posts: n/a
Default $_

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

Reply With Quote
  #2 (permalink)  
Old 02-25-2005
Andy Hassall
 
Posts: n/a
Default Re: $_

On 25 Feb 2005 11:40:06 -0800, "TekWiz" <tekwiz@twarlick.net> wrote:

>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?


It's not special in PHP. It is in Perl, where $_ is the default input and
pattern-searching space.

>Also, how can this be of use to me?


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.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Reply With Quote
  #3 (permalink)  
Old 02-26-2005
cyberhorse
 
Posts: n/a
Default 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

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:24 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0