Loading presentation...

Present Remotely

Send the link below via email or IM


Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.


Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Introduction to PHP

What does PHP look like? What are the commands and where do you get help?

Chintan Amrit

on 7 February 2013

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Introduction to PHP

Intro to PHP Writing PHP You will sprinkle your PHP inbetween existing HTML. PHP has its own delimeters:

<?php and ?>

You'll use these just like HTML delimiters. In between you'll add all kinds of php commands. Let's try it out. Put this code between the body tag.

<?php echo "Hello World"; ?>

Save your document. To start writing PHP you have to do a little bit of setup. Create a new HTML file. In order to add and run PHP commands, you'll have to change the file extension to .php.

In NetBeans you can simply create a new .PHP file. Create a .PHP Saving .PHP To save your page properly, save the document as test.php in your htdocs folder. This should be in C:\xampp\htdocs\

(see Intro to Web Servers if you don't have this folder) Accessing test.php Unlike regular .HTML files, you can't just double click on a .php file and run it. You can only access it through the http:// protocol to access this file, open a web browser and go to:
or Writing PHP Viewing test.php After you save, go to your browser and go to http://localhost/test.php. You should see this: Viewing the Code In the browser, view the source code. Your PHP code will not be there.

Remember the PHP code is run (or parsed) and only the output of the PHP is sent to the browser. Where's my code? It's OK, your .php document is fine and the PHP isn't gone. Go back to your text editor and it's safe.

Remember that it's parsed and you only see the output. Adding More PHP We can keep adding blocks of PHP code. Each block can contain multiple lines: <body>
echo "Hello";
echo " World";
</body> Terminators Notice the semicolons (;). You have to tell the computer when each individual command is done so the it can run them. This is done by putting a terminator character. Think of the echo "Hello" command as a sentence and the semicolon as the period. ; What's PHP? PHP is a server-side scripting language. It gives webpages the ability to respond to the user. It's not a fun as Flash but it's more like the workhorse that can process information on your page. PHP is sprinkled in with your HTML. So both languages live in the same document (possibly with JavaScript and CSS too!). The thing is, your users will NEVER see your PHP code in the browser. Ever. Here's why:

When a web browser sends a request to your web server for a webpage, the server will scan through your PHP page, process the code and create a new temporary HTML page that is sent to the user. The temp page has no PHP in it at all. First, this is a safety feature; your PHP code can have usernames and passwords and security functions (like for logging in) that you don't want the world to see. Well, why not? Second, sending PHP to the user would be useless to them anyway. Browsers don't know how to read PHP. So it would be a waste to send it to them. So my server needs to understand PHP? Yes. That's why PHP is a SERVER-side scripting language. The server will run the code.

JavaScript is a CLIENT-side scripting language. That code is sent to the users and the browser has to run that code. But why do we need server and client languages? Client-side languages allow the page to become dynamic, to respond to the user, to animate and validate forms BEFORE they are sent.

Server-side languages are more useful for retrieving and manipulating data. PHP is great at getting information from databases. With PHP, your web pages can now:

Register a user
Login a user
Customize the information on a page for a user
Run a search
Pull information from a database
Add, edit or delete the information in a database
Record the hits on a webpage
Create a commenting system
Upload images to a server More Info http://www.php.net
This is the site for the body that is in charge of PHP. It has a searchable database of every PHP command, what they do and examples. Bookmark this site and use it!
Full transcript