Tuesday, July 3, 2012

Find if url(current address) contains "?" or not with php

//  how to find the current url contains  the "?" or not
// to verify the current url has the one/single query string variable or many  string variable
function  get_urlsigntype($current_url) {
    if(strpos($current_url, '?') === false) {
        return "?";
    } else {
        return "&";
    }
}

Monday, July 2, 2012

How to get client's IP address with PHP

<?php
//  get the  client ip address and store into the variable.

$client_ipaddress = $_SERVER["REMOTE_ADDR"];
echo "Client IP is :".$client_ipaddress;
?>

Get Current file Name in php

<?php

//  get the current file name
$currentFile_Name = $_SERVER["SCRIPT_NAME"];
echo basename($currentFile_Name); 
 
?>

Comments in PHP

1. Single Line Comment

<?php
 //here is any code
//echo "this  is test";

?>



2. Multiple Line Comment

<?php
/* Here is your  code 
 
echo " this is test..."; 
echo "this is not display at screen";
*/
?>

Php tags

1.  php short tag  


<? = ?>

2. php full tag


<?php
// write your code here

?>

Thursday, June 28, 2012

PHP: Hypertext Preprocessor

PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. The php  code is interpreted by a Web server with a PHP processor module which generates the resulting Web page.

Friday, December 17, 2010

Wednesday, December 8, 2010