Powered By Blogger

Tuesday, 8 February 2011

Back-tick operator

Backtick operator is actually a combination of two back ticks...... back ticks are not  quotes.... back tick is usually located on the same key on which the tilde mark can be found .



back tics are used to execute what ever comes between these two individuals ....as a server command depending upon server command line language


`command to execute`

The error suppression operator

error suppression operator @ should be kept before the anything that evaluates  to be some value.

$a=@(300/0);

in this way the divide by zero error will not be generated during the runtime although you will need to write some error handling code when the warning is generated.....

if you have track_error option enabled in php.ini file then this message will be stored in $php_errormsg variable.....

Parse the URL


Lets take a simple example of an URL with some attached Query string
WWW. Facebook.com?&src=india&sid=2748472&ver=2hqhwu&height=123

so as u see that now if you need  to use these parameters those have come to you in the form of a query string you  have to parse them down so here is  what you can try

$src = urldecode($_GET['src']);

$sid = urldecode($_GET['sid']);

$ver = trim(urldecode($_GET['ver']));

$height = urldecode($_GET['h']);





here we are using the urlencode() function to convert the values of the $_GET[] global array in human readable form

The magical operator:The ternary operator

Ternary the magical operator is a very useful tool while you need to code frequently .....it enables you to work more frequently while you need to push a value on a variable depending upon the evaluation of any condition

                                                    condition ? 'value1' : 'value2'

if the condition evaluates to be true then the outcome of the above line will be 'value1' else value2....

until now i know your mind must be striking to say ohhhh    i can do this with then if ...else logic

but my friend i will love to say just taste it once and u will definitely become the fan of it's spice.......


very recently i was looking at some work done by my seniors..where i could see the really intense and smart utilization of this amazing tool........