extract in php code example
Example 1: strpos in php
<?php
$mystring = 'abc';
$findme = 'a';
$pos = strpos($mystring, $findme);
if ($pos === false) {
echo "The string '$findme' was not found in the string '$mystring'";
} else {
echo "The string '$findme' was found in the string '$mystring'";
echo " and exists at position $pos";
}
?>
Example 2: string contains php
$a = 'How are you?';
if (strpos($a, 'are') !== false) {
echo 'true';
}
Example 3: php array extract value
<?php
$array = array("size" => "XL", "color" => "gold");
print_r(array_values($array));
?>
Example 4: extract($user_input); alternative php
$info = array('Doina', 'brown', 'long');
list($she, $color, $hear) = $info;
echo "$she has $color eyes color and $hear black hair.\n";