An array is a special variable that can hold multiple values. There are two main types of arrays: numeric and associative. Numeric arrays use integers as indexes and associate arrays use named keys. Functions like in_array(), is_array(), implode(), and explode() allow you to check/manipulate arrays. The GET and POST methods are used to submit form data, with GET appending values to the URL and POST sending values via HTTP headers.
1 of 13
Downloaded 12 times
More Related Content
Array,Array Function,Get Method,Post Method
1. What is array?
?An array is a special variable, which can hold more
than one value at a time.
Syntax:
array(¡°string¡±,¡±string¡±,¡±string¡±);
Example:
$a=array(¡°hello¡±,¡±world¡±);
echo $a[0];
echo $a[1];
3. ? Numeric array is used for numeric value.
? The index can be assigned automatically
(index always starts at 0), like this:
Syntax:
$array[0];
$array[1];
4. ? Associative arrays are arrays that use named keys that you
assign to them.
Syntax:
array(¡°practical"=>¡°value", ¡°name keys"=>¡°value",
¡°name keys"=>¡°value");
Example
$a=array(¡°practical¡±=>¡±hello¡±,¡±practical1¡±=>¡±world¡±);
echo $a[¡°practical¡±];
echo $a[¡°practical1¡±];
10. Implode is used for convert array to string.
Syntax:
implode(variable name);
Example:
<?php
$c=array("hello","how","are","you");
echo implode(" ",$c)."<br>";
?>
11. Explode is used for convert string to array.
Syntax:
explode(¡°first parameter¡±,variablename);
<?Php
$d="hello how are you";
$e=explode(" ",$d);
Echo $e[0];
Echo $e[1];
?>
12. Get : used for get a value from form.
<form action=¡°¡± method="GET">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="submit" /> </form>
Output:
http://www.test.com/index.html?name1=valu
e1&name2=value2
13. Post : used for get a value from form.
<form action=¡°¡± method=¡°post">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="submit" /> </form>
Output: http://www.test.com/index.html