What is the better way to write setter and getter in PHP? I mean, is better for a member class to have separate methods for getting and setting its value OR to have only one method for set and get?

» Read More

If you want a copy of "Nusphere PhpEd" the professional integrated development environment for building web-applications using php scripting language, you can buy one or you have to win the programming contest. You have to create a script that simulates the "Texas Holdem Poker" game and send it to contest@php-editors.com before Wednesday 1st March 2006 at 23.59 (GMT).

Good luck.
Use single quoted strings unless you need to interpolate variables into your string. This saves PHP the time to scan the string for contained variables and saves about 50% execution time. here is a benchmark:

» Read More

Ivo Jansch at the "Achievo blog" has wrote a post about what he calls "Defensive programming". The problem is very simple but not all developers that take care of such thing:

Look at this code:

» Read More

You probably know that you can use PHP as scripting language. PHP CLI (PHP Command Line Interface) is there for that. It was first released in PHP 4.2.0 as experimental, but as of PHP 4.3.0, it is fully functional and enabled by default. In this example, I will write a very simple script that will list and email me all running process on my linux box and then I will add an entry in the crontab to run the script every day at 23:00

» Read More

A hacker doesn't really need PHP to send an Email. He needs only a command prompt and a telnet program, that's all. But we are in the PHP Zone, so we will do it with PHP too. All the stuff here is for learning purpose. Don't use it to hack or to spam or to do any other illegal action.

First, a good start is to read the SMTP specification protocol. It helps to understand how things work. You can read the Request For Comments number 2821 document (RFC2821) for that. It's a good idea to read the entire document, but if you haven't the time, just read the chapter 4.

» Read More