PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have great dificaulty remembering when i should use (brackets) when i should use {curly brackets} when i should use "quotation marks", 'quotation marks' [square brackets] etc.
I cant seem to find any documentation that explains just this. i would find it so much easier if i had reference!!
Forgive me if this is already on this forum, i just cant find it if it is!
Expressions go in brackets. Expressions are ($var), ($var == 1), ($var < 3) etc.
Code blocks require curly brackets { }.. so a simple if/else would look like this
if ($var < 3)
{
//do something here
} else
{
//do something else here
}
Strings can use either " or '
echo 'My name is Scott';
echo "My name is Scott";
However, variables can be interpreted inside double quotes only
$name = 'Scott';
echo "My name is $name";
However, you can use single quotes and concatenation
$name = 'Scott';
echo 'My name is ' . $name;
Array indexes go in brackets []
$_POST['username']
$_POST['password']
$MyArray[3]
The indexes can be treated the same as strings
$_POST["$var"]
$_POST['var' . $var]
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.