Tag Archives: core PHP
Code Sample: explode()
See manual. explode() returns an array of strings. Each array element is a substring of the main string. The substrings are the fragments resulting from the explosion along boundaries specified by a delimiter string.
PHP String Type Encoding
base64_encode(), base64_decode(), chunk_split(), convert_uuencode() and RFC 2045 section 6.8 are topics which I may want to investigate if I use strings to hold binary data (rather than character data). They are about putting binary data into the lower bits of … Continue reading
PHP functions for inspecting variables
print_r(), var_dump() and var_export().
Where to find info about PHP Sessions
Navigating the PHP manual can be a challenge. To use it for PHP sessions start with the page Runtime Configuration.
how long does a session last
I’ve concluded that leaving the session mechanism in its default state is alright as long as I’m aware of the limitations. Specifically I can’t count on the session lasting more than 24 minutes; And, if I the user terminates the … Continue reading
passing along session variables
The session variables are stored in an enumerated array called $_SESSION. For example if you want to store the number of candies in a plate you would do: $_SESSION[‘qty_candy’] = 5; assuming you already called session_start() of course.
ternary operator
Another conditional operator is the “?:” (or ternary) operator. See PHP Manual.
numeric types
Two Numeric Types: integer double See coercion. Integer Read Formats: decimal octal (has leading 0) hexadecimal (has leading 0x) Decimal Read Formats: standard scientific notation Print Formats: See printf().
integer size
Integer size can be determined using the constant PHP_INT-SIZE, and maximum value using the constant PHP_INT_MAX.
integer overflow
Integer overflow happens when an integer value becomes too large to store as an integer type on the system being used by the script. What PHP will do when this happens is convert the value’s type to double. Keep in … Continue reading