Basic Aspects of PHP | Class Assignment | By Cindy Bryant

PHP

1. What is PHP?

  • PHP stands for PHP: Hypertext Preprocessor
  • PHP is a server-side scripting language (Server-side scripting is a web server technology in which a user’s request is verified by running a script directly on the web server to generate dynamic web pages), like ASP
  • PHP scripts are executed on the server
  • PHP supports many databases (MySQL, Oracle, Sybase, Solid, etc.)
  • PHP is an open source software
  • PHP is free to download and use

2. Describe briefly the history of PHP.

As a web language PHP is without a doubt the most popular server language currently in use. PHP was founded in 1995 by Rasmus Lerdorf, because he needed to build a tool that would track the access to his web page. He used C to create his tools and then he released his tools to open source community under the name PHP/FI (PHP Form Interpreter).

In the first release it had many syntax similarities with Perl and in 1997 PHP 2 was released with some new features. In 1998 PHP 3 was released with many more flexible features in it. And even in that stage it’s said to have occupied 10% of web servers.

PHP 4 came in the year 2000 and it brought a new look to PHP language. A new object oriented look, which resulted in initiating many new web trends such as CMS and Frameworks. In 2004, PHP 5 was released with enhanced OOP abilities.

3. Describe general usage of PHP like server-side scripting, command-line scripting, and client-side GUI applications.

PHP is a general-purpose server-side scripting language originally designed for Web development to produce dynamic Web pages. It is among one of the first developed server-side scripting languages to be embedded into an HTML source document, rather than calling an external file to process data. Ultimately, the code is interpreted by a Web server with a PHP processor module which generates the resulting Web page. It also has evolved to include a command-line interface capability and can be used in standalone graphical applications. Any PHP code in a requested file is executed by the PHP runtime, usually to create dynamic Web page content or dynamic images used on Web sites or elsewhere. It can also be used for command-line scripting (Unlike web scripts, Command line scripts doesn’t have any maximum execution time limit and they can run as long as they can, unless until the server shuts down. Using command line scripting, we can accomplish many time consuming tasks like taking backup of entire website and databases, transferring files to another server through ftp, and many more), and client-side GUI applications. PHP can be deployed on most Web servers, many operating systems and platforms, and can be used with many relational database management systems (RDBMS). It is available free of charge, and the PHP Group provides the complete source code for users to build, customize and extend for their own use.

PHP acts primarily as a filter, taking input from a file or stream containing text and/or PHP instructions and outputting another stream of data; most commonly the output will be HTML.

Web content management systems written in PHP include Joomla, WordPress, Drupal. All Web sites created using these tools are written in PHP, including the user-facing portion of Wikipedia, Facebook, and Digg.

4. Explain basic PHP syntax.

A PHP scripting block always starts with <?php and ends with ?>. A PHP file normally contains HTML tags, just like an HTML file, and some PHP scripting code. Below, we have an example of a simple PHP script which sends the text “Hello World” to the browser:

<html>
<body>

<?php
echo “Hello World”;
?>

</body>
</html>

Each code line in PHP must end with a semicolon. The semicolon is a separator and is used to distinguish one set of instructions from another.

There are two basic statements to output text with PHP: echo and print. In the example above we have used the echo statement to output the text “Hello World”.

Note: The file must have a .php extension. If the file has a .html extension, the PHP code will not be executed.

In PHP, we use // to make a single-line comment or /* and */ to make a large comment block.

Variables are used for storing values, like text strings, numbers or arrays.All variables in PHP start with a $ sign symbol. The correct way of declaring a variable in PHP:

$var_name = value;

Example:

<?php
$txt=”Hello World!”;
$x=16;
?>

PHP is a Loosely Typed Language: In PHP, a variable does not need to be declared before adding a value to it. PHP automatically converts the variable to the correct data type, depending on its value.

Naming Rules for Variables:

  • A variable name must start with a letter or an underscore “_”
  • A variable name can only contain alpha-numeric characters and underscores (a-z, A-Z, 0-9, and _ )
  • A variable name should not contain spaces. If a variable name is more than one word, it should be separated with an underscore ($my_string), or with capitalization ($myString)

5. Explain how PHP can be applied to a website.

To get access to a web server with PHP support, you can:

  • Install Apache (or IIS) on your own server, install PHP, and MySQL
  • Or find a web hosting plan with PHP and MySQL support

If your server supports PHP you don’t need to do anything. Just create some .php files in your web directory, and the server will parse them for you. Because it is free, most web hosts offer PHP support. However, if your server does not support PHP, you must install PHP.

PHP enjoys such widespread popularity because:

  • It is easy to learn: Its C-like syntax makes it an easy language to learn for programmers and nonprogrammers alike.
  • It blends well with HTML: You can mix PHP scripts right inside your HTML or place HTML tags and code inside PHP files.
  • PHP has a vast library of functions and APIs: PHP’s ability to interact with LDAP, databases and the file system makes it a great “one stop shop” for developers.
  • You can rapidly create Web applications and database-backed applications: PHP is so often used with databases, especially open-source databases, that several books are available on the shared topic of PHP and MySQL.
  • It is cross-platform capable: PHP is used on Windows, Linux, commercial flavors of Unix and MacOS X.

Bibliography

http://scholar.lib.vt.edu/manuals/php3.0.6/intro-history.html

http://www.w3schools.com/PHP/default.asp

http://kidoos.net/forums/t/35.aspx

http://en.wikipedia.org/wiki/PHP

Advertisements

Minted.com is Running the Best Designer Contests!

If you’re a designer, or even photographer you can participate in Minted.com designers contests.  I’m writing about this for two reasons.

1. I want to ask you for your support and vote!  I have submitted one of my images for the Wall Art contest.  The link to my art is below, please click on it and vote for my work!

2. I wanted to share the good news with all of you.  By that, I mean you as the designer entering your work to the Minted contests.

At the very least, browse the site and take a look at their designs even if you do not submit for the contest, you can certainly get inspired from other beautiful designs.

Now, go vote for my art!  Thanks;)

Click on this link:

http://www.minted.com/designer/cindyjbryant

Noteworthy: Web page size and layout

Noteworthy:  A Website Design “must read” article.  Now that I’m at the beginning stages of starting my first “Website Page Design and Layout” class project, I find myself still a bit clueless.  Somehow, I’m capable of designing, but it’s like part of my brain cannot link the basics of a website page layout….dunno!  So to get myself started I did a little “google research” and came across this pretty awesome article by Iteracy, Ltd.  This article discusses all the missing links such as page sizing, and it’s anatomy.  Click the link below.

Web page size and layout : Iteracy – Web Designers Cornwall

Credit: Iteracy, Ltd.

How to Register Your Photos with the U.S. Copyright Office | Chris Martino/blog

Noteworthy:  If you’re a photographer, or artist making original images or work from scratch this is the MUST read article and step-by-step on how to properly protect your images and/or work through the US copyright office.  Just because you are the originator of your image or work and it is copyright work, it does not mean that your work is automatically registered and/or protected through the US Copyright office.  Stealing anyone’s work from images to music or anything that isn’t your original work is stealing and it’s a Federal Offense. Here’s a very useful and educational article and link to help you get started on how to register your work with the US copyright office.

Link:  How to Register Your Photos with the U.S. Copyright Office | Chris Martino/blog.

Article credit:  Chris Martino/blog

WordPress Basics for Photographers: Part One

Noteworthy:  As a photographer myself, and now a student in Web Design and Development I’m still learning aspects of design and looking forward to digging into the developmental coding side of the web.  I’m not quite there yet, but on my way.

A friend-photographer forwarded me this wonderful article post that gives details on the basic needs of selecting the right type of web templates, why WP templates are ideal for browser related reasons, and just simple steps to getting anyone started in this process.   I found it to be helpful and educational, and plan to use it as a guide for myself, hopefully  you will find some use in it for your designing needs.  “Click on link below my work of art image.”

Article Credit: Wizwow on Apr 4, 2012 in Going Pro, LE News and Info

Image/Photographer Credit: ©2012 Cindy Bryant

WordPress Basics for Photographers: Part One

WordPress Basics for Photographers: Part One.

Noteworthy: Adobe Photoshop CS6 new enhanced features for photographers

I follow Annie Manning’s Paint The Moon Blog for several reasons.  For starters she’s a Web and Actions Designer, and Photographer.  In addition, she has a natural ability to make photo editing tutorials that are easy to follow.  Lastly, I like her style it’s simple and clean.  Since I’m a photographer, and now a Web Development and Design student; I enjoy following Annie’s blog for her editorial and point of view.  Here’s a great tutorial by Annie Manning of Paint The Moon describing in details Adobe Photoshop CS6 “New and Enhanced” features best suited for photographers or anyone really.

Adobe Photoshop CS6 best new enhanced features for photographers

Photoshop Tutorial “Puppet Warp v. Liquify Technique”

Photoshop Tutorial “Puppet Warp v. Liquify Technique”

Noteworthy: Another great find, a video tutorial that shows the new Photoshop CS5 feature called “PuppetWarp” and “Liquify” techniques differences.  Both techniques can be quite useful from big jobs to the smaller details, it really depends.  

Credit:  Video tutorial by Ascend Training