Background:

PHP is a server-side scripting language. Like JavaScript, it provides logic to a website, but unlike JavaScript, PHP runs on the server, so it cannot be disabled or modified, in addition, the script is hidden to anyone except the administrator this makes it difficult for someone to use the source to crack the page. These all contribute to PHP being a secure language. PHP is easy to work with, free, and cross-platform making it a popular language (as opposed to ASP.NET). Although PHP can be a standalone language, it almost always accompanies HTML. PHP now has features which make it an object oriented language, this is good because it paves the way for libraries and more powerful web applications, which JavaScript, JQuery, and others have been dominating in.

PHP and Me:

I actually learned PHP before I learned JavaScript. The first page I put on this website (tri.php) was a PHP triangle area calculator. I now want to convert it to JavaScript. You can check out my chatroom which I built with PHP (I will release the source soon), this was a challenge to me. I decided not to use SQL (database language) and I opted for a simple system which didn't open the door to SQL injection and give administrator priveleges to anyone who wanted to post something. I instead used file IO which proved to be an effective system. My host doesn't keep my PHP up to date so I tend to fear using code from online. The majority of my ideas for future web applications will bee using JavaScript, or a variety of it, but PHP is a good tool to have.

Syntax:

PHP and JavaScript are vaguely similar, yet are completly different languages. One of the most noteable differences is that all variables must start with a currency symbol. Also note that the only difference in the comments of PHP and JavaScript are that PHP allows you to use a # as an equivalent to the // standard for end of line comments. PHP code should always be included in HTML by using the <?php and ?> symbols.

<?php
	$foo = "bar"; //no formal declarations, just start using them
	if($foo=="bar"){#if statement
		echo "foo=bar";//output html
	}
?>
Web Hosting PHP-powered