//this file is about arrays
//empty array
$ar = array();
//add value "4" to first possible index
$ar[] = 4;
foreach ($ar as $b); {
echo $b."
";
}
//add value "5" to second index
$ar[2] = 5;
foreach ($ar as $b); {
echo $b;
}
Posts mit dem Label array werden angezeigt. Alle Posts anzeigen
Posts mit dem Label array werden angezeigt. Alle Posts anzeigen
Montag, 2. Juni 2014
PHP Basics: Storing Creating and storing Arrays
Arrays are very powerful. You can use them to store a set of data, compare them and update them incrementally.
Here is a short example how adding is one
Sonntag, 1. Juni 2014
PHP Basics: How can I convert from "int" to "bool", "float", "string", "array", "object"
converting variables using "int", "bool", "float", "string", "array", "object".
There are several ways to cast a variable into a different variable type. This is useful in order to control what type a
variable currently is. there are specific cast commands, yet you can also assign the operators in order to make sure the
variable behaves as expected
Be aware that even tough integer variables can hold significant data of up to 2147483647 on a 32-Bit system, therefor they can run into overload.
$k = 4; //this will initialize the variable and set it up to be an integer $l = (float) $k; // this converts the variable to a float var_dump($l);The Output is "float(4)", since the variable was converted from integer to float
Be aware that even tough integer variables can hold significant data of up to 2147483647 on a 32-Bit system, therefor they can run into overload.
Abonnieren
Posts (Atom)