Now, if you have installed XAMPP or another package including php on your local computer as explained in this
http://www.oopschool.com/phpBB3/viewtop ... f=11&t=174
thread, it is actually very easy to test the php code examples on your local machine. All you need is to have Apache and php running, and copy and paste the code like in this slightly modified code
Code: Select all
<html>
<body>
<?php
$d=date("D");
if ($d=="Fri")
echo "<h1>Have a nice weekend!</h1>";
elseif ($d=="Sun")
echo "<h1>Have a nice Sunday!</h1>";
else
echo "<h1>Have a nice day!</h1>";
?>
</body>
</html>
<your xampp installation>/htdocs/(subfolder)/
Example: C:\xampp\htdocs\tests\example1.php
Then point your browsere at http://localhost/tests/example1.php
That is all.
You can of course test the code on an online PHP interpreter or shell like http://ideone.com/
See http://stackoverflow.com/questions/4719 ... -languages for additional information.
Using WordPad when you start developing HTML, CSS, JavaScript, PHP is also recommended by many professional web masters.
A note on security: If you wan't to write "relatively secure PHP MySQL / PostgreSQL code", on the web, make sure your hoster has installed the latest stable version of php and learn to use the http://php.net/manual/en/book.pdo.php database object and prepared statements. Also store the database access file above your web directory.