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.

Posted in PHP String | Tagged , , | Leave a comment

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

Posted in PHP String | Tagged , , , , , , , | Leave a comment

PHP functions for inspecting variables

print_r(), var_dump() and var_export().

Posted in PHP Debugging | Tagged , , | Leave a comment

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.

Posted in PHP Sessions Cookies and Header | Tagged , | Leave a comment

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

Posted in PHP Sessions Cookies and Header | Tagged , | Leave a comment

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.

Posted in Coding, PHP Sessions Cookies and Header | Tagged , , | Leave a comment

ternary operator

Another conditional operator is the “?:” (or ternary) operator. See PHP Manual.

Posted in Coding, PHP Language Constructs | Tagged | Leave a comment

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().

Posted in Coding, PHP Data Value Types, PHP Math | Tagged , | Leave a comment

integer size

Integer size can be determined using the constant PHP_INT-SIZE, and maximum value using the constant PHP_INT_MAX.

Posted in Coding, PHP Math | Tagged , , , | Leave a comment

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

Posted in Coding, PHP Data Value Types, PHP Math | Tagged , | Leave a comment