PHP Tutorials

31. Function within another function in PHP

By: Martyniuk Vasyl : 2011-10-28

Description: If you define function within another function, it can be accessed directly, but after calling parent function.


32. Get the first and last day of the month in PHP

By: Binu v Pillai : 2011-08-12

Description: Another useful function to find the first and last day of the month from the given date in PHP


33. Get the next working day in PHP

By: Moshe : 2011-08-12

Description: Here is an useful code snippet that calculates the next working day in the US. This takes into account the US Federal holiday as well.


34. is_utf8 in PHP

By: rodrigo : 2011-07-31

Description: I've been working on a is_utf8 function and wanted to post it here, in addition to others i also took in consideration the 5000 char bug:


35. Perl's Encoding::FixLatin equivalent in PHP

By: squeegee : 2011-07-31

Description: I think this is a reasonable port of Perl's Encoding::FixLatin by Grant McLean, which converts a string with mixed encodings (ASCII, ISO-8859-1, CP1252, and UTF-8) to UTF-8.


36. fixEncoding in PHP

By: mrezair : 2011-07-31

Description: I found this little function very useful in fixing strings that are not in utf-8 but need be converted


37. Retrieve multiple rows from mysql and automatically create a table in PHP

By: jhulbert : 2011-07-09

Description: Quite often, you need to retrieve rows from a mysql table and display it on a PHP page. Every time, the number of columns and rows are different. So you can use this useful php code snippet that takes care of formulating the table automatically with the results obtained irrespective of the number of columns or rows.


38. Convert a hex string into a 32-bit IEEE 754 float number in PHP

By: Julian L : 2011-04-08

Description: onvert a hex string into a 32-bit IEEE 754 float number. This function is 2 times faster then the below hex to 32bit function. This function only changes datatypes (string to int) once. Also, this function is a port from the hex to 64bit function from below.


39. Floating point precision in PHP

By: Mahesh : 2011-04-08

Description: Floating point numbers have limited precision. Although it depends on the system, PHP typically uses the IEEE 754 double precision format, which will give a maximum relative error due to rounding in the order of 1.11e-16. Non elementary arithmetic operations may give larger errors, and, of course, error progragation must be considered when several operations are compounded.


40. Convert IP address to integer and back to IP address in PHP

By: Darkshire : 2011-04-08

Description: Here are some tricks to convert from a "dotted" IP address to a LONG int, and backwards. This is very useful because accessing an IP addy in a database table is very much faster if it's stored as a BIGINT rather than in characters.