PHP BASICS : PHP BASICS
WHAT YOU WILL NEED TO LEARN : WHAT YOU WILL NEED TO LEARN PHP version 5
MySQL
Terminal, SSH, Telnet(putty)
FTP (to host) or other tools
Basic HTML. - read it on w3schools.org
WHERE TO FIND MORE INFO : WHERE TO FIND MORE INFO www.php.net
Needed for referring for functions and other resources
You, like me, and most people will not be able to keep all info on you mind
It is very detailed. So make sure you are looking for the specific thing you need
You can use the search facility
Live demo
Check version, Function name, return type, arguments, Optional arguments
Text description.
Example on how to use
Search can take you to chapters as well. Example, search for 'mysql' - takes you to chapter. mysql_connect takes to function
free text search, eg File Permissions
MORE RESOURCES : MORE RESOURCES php.net-> mailing lists
-> General user list
www.zend.com, hotscripts.com, Google, Bing
Wikipedia for finding hosts and other info
THE STACK- WAMP : THE STACK- WAMP Go to WampServer site, Download, Install
Show the Control Panel
localhost, status, phpinfo, phpmyadmin
Editor
Notepad++
Or BlueFish Editor
BLUEFISH : BLUEFISH Go to BlueFish site- sourceforge
Download, install
Basics of BlueFish
Set the basedir
Code Snippets
How to create
How to use
How to export
Import
SIMPLE EXAMPLE : SIMPLE EXAMPLE Use Snippets
Use "echo" to print
Notice ; at end
DATA TYPES : DATA TYPES Why Data Type- Operation & Memory
8 Basic Categories or Data Types
4 Scalar variables:
Integer, Float, String, Boolean ( true/false)
2 Compound Type:
Array , Object ( -will see later)
Special Types
Resources - External Resource, File/db
NULL- null contains no value
Loose Typing
PHP is loosely typed
Varaibles get converted depending on context
PROS - CONS : PROS - CONS Pros:
Variable are flexible
Cons
No warning of wrong type usage. Loss of precision
TESTING TYPE OF VARIABLE : TESTING TYPE OF VARIABLE gettype()
$var
echo gettype($var);
$var = 5;
echo gettype($var);
CHANGING DATA TYPE : CHANGING DATA TYPE settype()
$var = 10.5;
echo $var;
settype($var,"string");
echo $var;
settype($var, "integer");
echo $var;
settype($var. "float");
echo $var;
CHANGING TYPE USING CASTING : CHANGING TYPE USING CASTING $var = 10.5;
echo $var . "
";
echo (string) $var . "
";
echo (int)$var . "
";
echo (float)$var . "
";