Login form



PHP. Data types of variables
Print array:
<?
$a = array(1,10,11, 10 => 10,11=>"text");

foreach ( $a as $r=>$b){
echo "$r ir $b   <br>";
}
?>

Change values:
<?
$a = array(1,10,11, 10 => 10,11=>"text");

foreach ( $a as $r=>$b){
$a[$r]= $b . "labas";
}

foreach ( $a as $r=>$b){
echo "$r ir $b   <br>";
}
?>

Simple:
<?
print_r ($a)
?>

Operations with data types:
<?

$foo=1.23234364231313131314343545431;
echo "$foo <br>";
echo gettype($foo)."<br><hr>";

$foo=(float)$foo ;
$foo=134646416464646579464987694687.131361;
echo "$foo <br>";
echo gettype($foo)."<br>";

$foo=(bool)-111.5464564564564;
echo "$foo <br>";
$foo = faLSE;
echo "$foo <br>";
echo gettype($foo)."<br>";

$foo="mano";
echo $foo[1] ."<br>";
$foo=(array) $foo;
echo "$foo <br>";
echo "${foo[0]} <br>";
echo $foo[1] . "antras elementas -nėra<br>";
echo gettype($foo)."<br>";

$foo=(string) $foo[0];
echo "$foo <br>";
echo "$foo[0] <br>";
echo gettype($foo)."<br><hr>";

// is_array - Finds whether a variable is an array
//is_bool is_double is_float is_int is_integer is_long is_null is_numeric is_object is_real is_string
?>
 
[ BBC news ][ Yahoo news ][ Linux guru ][ Webmaster ACE ]