CodeRun – Full Featured Online IDE
I've recently started using CodeRun for quickly testing live code. It's a free full featured web-based IDE which you can use to develop applications or simply test code snippets. It also allows you to share working code with others to test and review. Here's the official description:
CodeRun Studio is a cross-platform Integrated Development Environment (IDE), designed for the cloud. It enables you to easily develop, debug and deploy web applications using your browser.
CodeRun supports popular languages including PHP, JavaScript, HTML, CSS, and C#. If you are a developer, you should check it out.
10 Common PHP Mistakes to Avoid
These are some very common mistakes that are made in PHP. Some of these can be tricky to catch and can lead to all sorts of strange behavior. So here are 10 common PHP coding mistakes to avoid.
1 '=' Vs. '=='
Using a single '=' in a comparison will cause an assignment and return true, so this mistake can have some pretty unexpected results. It can be hard to catch since it looks perfectly valid to the interpreter if you are comparing something with a variable.
An easy way to avoid this is to swap the subject and variable like this:
< ?php if(true = $something) { // Parse error! // do stuff } ?>
The above will result in a parse error since you can't assign a literal to something, making it easy to catch and fix.
2 '==' Vs. '==='
There is a big difference between the '==' (equal) and '===' (identical) comparison operators. '==' will convert types to match before making the comparison, while '===' will compare directly without converting. So in situations where the difference between '0' and 'false' matters, you must use '==='. Here's some examples:
< ?php var_dump(false == 0); // true var_dump(false === 0); // false var_dump(false === false); // true var_dump('0' == 0); // true var_dump('0' === 0); // false ?>
