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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |
![]() |
| Thread Tools | |
| Display Modes | |
|
|