Credits: Larry Ullman author of PHP and MySQL for Dynamic Web Sites - ISBN: 0-321-33657-7
This is the book that I am learning PHP from, and I like it. I am picky about books too. The author writes in a way that is good for any level of programmer. I already know HTML, and have worked with JavaScript, but have never touched PHP, and I get along with this book easily. Most of the information here I learned from this book. Syntax
All PHP code must appear between the tags below.
<?php
?>
Or another version.
<?
?>
Either one will work. Printing to the Browser
In JavaScript you have the document.writeline to send the JavaScript output to the browser, but it is limited. In PHP it is a lot more versatile.
echo()
USE
echo "Text to show up in browser";
OR
print()
USE
print "Text to show up in browser";
Single Line Comments
# Rest of line is commented out
OR
// Rest of line is commented out
Multi Line Comments
/* Everything from the start of this line
to the end of this line is commented out */
Scalar or Single Valued
- Boolean - True or False
- integer - whole number
- floating point - decimal
- strings - text
NonScalar - MulitValued
- arrays
- object
and...
NULL - no value
variable names....
- are case-sensitive
- must start with a $
- can contain combinations of letters, numbers and the unserscore
- first letter after $ must be a letter or underscore
- are assigned vales by the =
Use the period [.] to combine, or concatenate two strings together
$string1= "Begin String"
$string2= "End String"
$string3= $string1 . $string2
NOW
$string3= "Begin StringEnd String"
