1
2<?php
3$mystring = 'abc';
4$findme = 'a';
5$pos = strpos($mystring, $findme);
6
7// Note our use of ===. Simply == would not work as expected
8// because the position of 'a' was the 0th (first) character.
9if ($pos === false) {
10 echo "The string '$findme' was not found in the string '$mystring'";
11} else {
12 echo "The string '$findme' was found in the string '$mystring'";
13 echo " and exists at position $pos";
14}
15?>
16
17
1
2<?php
3$array = array("size" => "XL", "color" => "gold");
4print_r(array_values($array));
5?>
6
7
1
2<?php
3
4$a = "Original";
5
6$my_array = array("a" => "Cat","b" => "Dog", "c" => "Horse");
7
8extract($my_array);
9
10echo "\$a = $a; \$b = $b; \$c = $c";
11
12?>
13
1$arr = array('mango'=>'My favourite fruit','apple'=>'It is good for health','banana'=>'it is good for bones');
2
3// it will convert array to variable
4
5extract($arr);
6
7echo $mango."</br>";
8
9echo $apple."</br>";
10
11echo $banana;