Global Variables in PHP
‘superglobals’ variables are below and they can accessable to all functions and class, below are the superglobals $GLOBALS $_SERVER $_REQUEST $_POST $_GET $_FILES $_ENV $_COOKIE $_SESSION
‘superglobals’ variables are below and they can accessable to all functions and class, below are the superglobals $GLOBALS $_SERVER $_REQUEST $_POST $_GET $_FILES $_ENV $_COOKIE $_SESSION
Cookie is usualy store in webbrowser to identify a user.its a small file that server will place this file to the browser. Example To set cookie following function will use setcookie(“vasanthan”, “mydoubts”, time()+3600); we can change the expire time. we can access the cookie value using $_COOKIE[“vasanthan”];//here vasanthan is the name of the cookie For… Read More »
$service_url =’http://mydoubts.in/apspackage/’ $curl = curl_init(); curl_setopt($curl,CURLOPT_HTTPHEADER,array (“Content-Type:application/x-www-form-urlencoded”)); curl_setopt($curl, CURLOPT_POST, 1); // Do a regular HTTP POST curl_setopt($curl, CURLOPT_POSTFIELDS, ‘client_id=’ . urlencode($client_id) . ‘&’ . ‘client_secret=’ . urlencode($client_secret) . ‘&’ . ‘grant_type=client_credentials’ . ‘&’ . ‘scope=openid’); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($curl, CURLOPT_FAILONERROR, FALSE); curl_setopt($curl, CURLOPT_USERAGENT, “Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)”); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_URL,… Read More »
Session variable stores the information about a user that variable will be availbale to all pages and we can handle the login track using the session concept Session is time duration when the user start to browse a webpage and it will be live until the page close. in php we will use the ‘session_start();’… Read More »
Characters used in the date function d-day of the month 01-31 m-month 01-12 y-year in four digits Example: echo date(“Y-m-d”);
#you can use javascript to do client side validation # php code will do the server side validation more validation will be available in mydoubts.in
In PHP webapplication development to collect form data to another page we will use the following methods $_GET– this is used in the case when the form action is GET $_POST– this is used in the case when the form action is POST Sample form as below index.php ——— Name: Age: innerpage.php ————- if we… Read More »
It Resturns a string with backslashes infront of the characters. this function is case-sensitive Syntax —— addcslashes(string,characters) Both parameters are required fields. string-this is the String to be escaped characters-this is the characters/range of character to be escaped Example ——- $mystring=”Welcome to mydoubts”; echo addcslashes($mystring,’m’); Above statement will print the output as below Welco\me to… Read More »
1)sort-sort array in ascending order 2)rsort-sort arrays in descending order 3)asort-sort associative array in ascending order-based on value 4)ksort-sort associative arrays in ascending order -based on key 5)arsort-sort associative arrays in descending order-based on value 6)krsort associative arrays in descending order-based on key