chinmay.sahoo
New member
PHP isn’t rocket science, but at the same time, don’t expect to become an expert in five minutes. If you’re a design-oriented person, you may find it takes time to get used to the way PHP is written. What I like about it very much is that it’s succinct. For instance, in classic ASP, to display each word of a sentence on a separate line, you have to type out all this:
That may not seem a big difference, but the extra typing gets very tiresome over a long script. PHP also makes it easy to recognize variables, because they always begin with $. Most of the functions have very intuitive names. For example, mysql_connect() connects you to a MySQL database. Even when the names look strange at first sight,
<%@ Language=VBScript %>
<% Option Explicit %>
<%
Dim strSentence, arrWords, strWord
strSentence = "ASP uses far more code to do the same as PHP"
arrWords = Split(strSentence, " ", -1, 1)
For Each strWord in arrWords
Response.Write(strWord)
Response.Write("<br />")
Next
%>
In PHP, it’s simply
<?php
$sentence = 'ASP uses far more code to do the same as PHP';
$words = explode(' ', $sentence);
foreach ($words as $word) {
echo "$word<br />";
}
?>
That may not seem a big difference, but the extra typing gets very tiresome over a long script. PHP also makes it easy to recognize variables, because they always begin with $. Most of the functions have very intuitive names. For example, mysql_connect() connects you to a MySQL database. Even when the names look strange at first sight,