Welcome to PHPMule.com
A blog site which I am posting to during my learning of the popular programming language PHP. Feel free to leave comments!
-
PHP - Dynamic Content
Dynamic content in PHP basically means that the content changes. For example: If a visitor to your site submitted a comment you could have your script to output the date and time of the comment back to the user. As the date and time will be different in every comment it’s known as dynamic content. Let’s use the date function:
<?php
echo “<p>Comment processed. Date and time processed: “;
echo date (’H:i, jS F Y’);
echo “</p>”;
?>
The above will output to the browser: Comment processed. Date and time processed: 18:20, 4th April 2009
Quite easy to be honest and PHP can be used in many ways like this!
(Post created on Saturday, April 4th 09 at 18:40)
-
PHP Comments (using single-line and multi-line comments)
To make our lives easier we can use comments to let yourselves or other programmers know what a piece of code is doing. These are very much like notes as it describes what something is doing. This is essential in PHP when you look back at the code.
The PHP interpreter will ignore any comments as long as you put these comments in the correct format. There are two types of comments. One called single-line comments and one called multi-line comments which are both self explanatory really!
To insert a single line comment all you have to do is insert the ‘//’ after a line of code. For example:
echo ‘<p>Hello world.</p>’; // This is a statement that sends to the browser Hello world.
To insert a multi-line comment you have to insert your comment between these two tags: /* and */ anywhere in your code (most probably at the start or end of your script). For example:
/* Created by: Nathan
Last modified: 4th April 2009
Script purpose: Process comments
*/
Inserting comments is something you should get aquainted to as it can really help finding out what bits of code does what.
(Post created on Saturday, April 4th 09 at 17:50)
-
Starting PHP (Embedding PHP)
All PHP scripts are contained within PHP tags.
<?php and ?>
e.g. <?php echo ‘<p>Hello world.</p>’; ?>
What does the echo command do? The echo command prints the string passed to it to the browser. The above example will show ‘Hello world’ in the browser when opened.
Another example:
echo ‘I love ‘;
echo ‘PHP’;
will output ‘I love PHP’ in the browser. This is all simple stuff but it does get more complex!
(Post created on Saturday, April 4th 09 at 16:10)
-
Launching the PHPMule.com blog
Hiya, I’m very new to the PHP world of programming and I have decided to create this blog for my own personal use so I can easily log what I do. I do welcome others to see what I blog and by all means feel free to leave any comments if you wish.
Nathan
-
Archives
Recent Articles
- PHP - Rounding Off Numbers
- PHP - Single vs Double Quotation Marks
- PHP - Loading Files Into Your PHP Script By Using require() and include()
- PHP - Replacing Strings With Other Strings
- PHP - Finding Strings Within Strings
- PHP - Using strlen() To Test String Length
- PHP - Using The explode() Function
- PHP - Changing The String Case
- PHP - The nl2br() Function
- PHP - Trimming Strings
Links
Categories
- PHP (22)
- Uncategorized (1)


