Freelance web design - PHP SOLUTIONS: DYNAMIC WEB DESIGN MADE EASY How
PHP SOLUTIONS: DYNAMIC WEB DESIGN MADE EASY How hard is PHP to use and learn? 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: <%@ 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("
“) Next %> In PHP, it s simply “; } ?> 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, you can often work out where they came from. In the preceding example, explode() blows apart text and converts it into an array of its component parts. Don t worry if you don t know what variables, functions, or arrays are: they re all explained in Chapter 3, along with the other main things you need to know about the basics of PHP. Perhaps the biggest shock to newcomers is that PHP is far less tolerant of mistakes than browsers are with XHTML. If you omit a closing tag in XHTML, most browsers will still render the page. If you omit a closing quote, semicolon, or brace in PHP, you ll get an uncompromising error message like that shown in Figure 1-4. This isn t just a feature of PHP, but of all server-side technologies, including ASP, ASP.NET, and ColdFusion. It s why you need to have a reasonable understanding of XHTML and CSS before embarking on PHP. If the underlying structure of your web pages is shaky to start with, your learning curve with PHP will be considerably steeper.
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.