PHP Tutorials

21. __call() in PHP

By: Rob : 2011-10-29

Description: You can always call protected members using the __call() method - similar to how you hack around this in Ruby using send.

22. use() in PHP

By: Anonymous : 2011-10-29

Description: use() parameters are early binding - they use the variable's value at the point where the lambda function is declared, rather than the point where the lambda function is called (late binding).

23. 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.

24. Using class within a function in PHP

By: Albaity : 2011-10-28

Description: To use a PHP class within a function, you need first to load class OUT of the function and then you can use the class functions from your function.

25. func_get_arg() and func_get_args() functions in PHP

By: Marlin : 2011-10-28

Description: You may pass any number of extra parameters to a function, regardless of the prototyping. In addition, the arguments passed to a function will be available via the variable names defined in the function prototype, as well as via the func_get_arg() and func_get_args() functions.

26. extract() in PHP

By: Dietricha : 2011-10-28

Description: If you compiled with "--enable-track-vars" then an easy way to get variable function args is to use extract()

27. Return multiple values from a function in PHP

By: Devinemke : 2011-10-28

Description: A function can only return one value, but that value can be an array or other compound value.  If you want to just define several variables into the global scope within your function you can do two things

28. 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.

29. 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

30. 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: