- Single and double quotes
Everything within single quotes is considered a literal.
Double quotes replaces variable names with literal values.
So,
echo "print $variablename"; // OUTPUT : print 20 (assuming $variablename contains value 20)
echo 'print $variablename'; // OUTPUT : print $variablename
- Data types in PHP
integer, float, string, boolean, array, object
- Constants
define('CONSTNAME', value); //uppercase convention
Usage
echo 'value of constant is ' . CONSTNAME; //$ is not used
- Execution Operator
`command` within the ` ` characters executes the command and returns the output as it would to the system.
for example,
$out = `ls -a` would return the directory listing to $out
The <pre></pre> tag in html preserves formatting, so each directory is listed on a new line(try it)
echo "<pre>" .$out. "</pre>";
- if elseif else alternate syntax
if condition :
//
elseif condition :
//
else :
//
endif;
Everything within single quotes is considered a literal.
Double quotes replaces variable names with literal values.
So,
echo "print $variablename"; // OUTPUT : print 20 (assuming $variablename contains value 20)
echo 'print $variablename'; // OUTPUT : print $variablename
- Data types in PHP
integer, float, string, boolean, array, object
- Constants
define('CONSTNAME', value); //uppercase convention
Usage
echo 'value of constant is ' . CONSTNAME; //$ is not used
- Execution Operator
`command` within the ` ` characters executes the command and returns the output as it would to the system.
for example,
$out = `ls -a` would return the directory listing to $out
The <pre></pre> tag in html preserves formatting, so each directory is listed on a new line(try it)
echo "<pre>" .$out. "</pre>";
- if elseif else alternate syntax
if condition :
//
elseif condition :
//
else :
//
endif;
No comments:
Post a Comment