Wednesday, 25 December 2013

post and get method


    GET requests can be cached
    GET requests remain in the browser history
    GET requests can be bookmarked
    GET requests should never be used when dealing with sensitive data
    GET requests have length restrictions
    GET requests should be used only to retrieve data
    since form data is in the URL and URL length is restricted. A safe URL length limit is often 2048 characters but varies by browser and web server.
   

    POST supports advanced functionality such as support for multi-part binary input used for file uploads to web servers.
    POST requests are never cached
    POST requests do not remain in the browser history
    POST requests cannot be bookmarked
    POST requests have no restrictions on data length

Tuesday, 24 December 2013

array_merge and array_combine

array_merge merges the elements of one or more than one array such that the value of one array appended at the end of first array. If the arrays have same strings  key  then the later value overrides the previous value for that key .
<?php
$array1 = array("course1" => "java","course2" => "sql");
$array2 = array(("course1" => "php","course3" => "html");
$result array_merge($array1$array2);
print_r($result);
?>
OUTPUT :  
Array
(
[course1] => php
[course2] => sql
[course3] => html
)
Array_combine creates a new array by using the key of one array as keys and using the value of other array as values.
It returns the combine array of array 1 and array2 .
<?php
$array1    = array("course1","course2","course3");
$array2    = array(("php","html","css");
$new_array array_combine($array1$array2);
print_r($new_array);
?>
OUTPUT :
Array
(
[course1]  => php
[course2]    => html
[course3]    =>css
)