Peep in my mind

Categorized | Php, Web

PHP 101

Posted on 17 April 2009 by admin

php101

I started to pick up PHP and started reading this book PHP for the World Wide Web, Third Edition (Visual QuickStart Guide) written by Larry Ullman. Like any good student I like to make notes when I read then type it out mainly just so I can review what I just learned. (yeah it sound geeky but oh well only way i can learn) and since coding has never been my best subject I really do need to type it out over and over again. Anyways I figured I might as well keep my notes on my blog and share with you all. So if your reading my blog and trying to use my notes you should pick up the book too and follow along!

Definition of PHP

originally stood for Personal Home Page but it later changed and it now currently stands for Hypertext Preprocessor

  • php is an HTML embedded scripting language
  • php server side language
  • php allows users to create dyanmic pages
  • can run only on Php enabled web servers.

Basic PHP Syntax

  • PHP scripts should be save as a .php file
  • place php code within <? php code ?> tags
  • open “<?php”
  • closed “?>
  • php statements must end with “;” or error will occur.

Function

  • Functions in php are followed by parentheses () in which arguments are passed to the function.
  • php is case-insensitive when calling functions (variables are case sensitive in php).

Function: phpinfo()

  • this function list the spec of the php install on the sever
  • this is also a great way to test if php was installed properly on the server

Example :

<?php

// Show all information, defaults to INFO_ALL

phpinfo();

// Show just the module information.

// phpinfo(8) yields identical results.

phpinfo(INFO_MODULES);

?>

Function: print()

  • use to display text or Output a string
  • strings must be surrounded with ” ” numbers don’t.

Example:

<?php print (”Hello World”) ?>

Function: echo()

  • use to Output one or more strings

Example:

<?php echo (”Hello World”) ?>

Function: printf()

  • use to Output one or more strings

Example:

<?php printf (”Hello World”) ?>

To find more functions go to php.net./manual

2 Comments For This Post

  1. Yumi Says:

    nice stuff <3

  2. Yumi Says:

    i like it ;D

Leave a Reply

Advertise Here
Advertise Here

RELATED SITES