Home
XHTML
CSS
PHP
MySQL
SEO
JavaScript
Computer Basics
Number Systems
LINUX


PHP Values

PHP | Values | Operators | Functions | Arrays | Forms | Sessions-Cookies | Classes

A string value is a series of letters, numbers, or symbols defined as text characters. String values are declared within  ' '  quotes. The  " "  double quotes allow variable substitution and escape operators. The  \  backslash is the escape operator. Single quotes are like double quotes, but do not allow variable substitution or escape operators, except the  \  to escape the  \  and  '  operators. XHTML tags are coded within strings to be passed to the browser...

<?php

$variableName='String<br />Text';

echo $variableName;

?>

The output to the browser is...

String
Text




These are escape operators for double quotes...

\"  substitutes  " 
\\  substitutes  \ 
\$  substitutes  $ 
\n  line break (for code view or email headers)

<?php

$variableName1='String ';
$variableName2="\"Text\"";

echo $variableName1;
echo $variableName2;
echo '<br />';
echo "$variableName1 Text";
echo '<br />';
echo 'Here\'s More String Text';

?>

The output to the browser is...

String "Text"
String Text
Here's More String Text





A numeric value is an integer or decimal number, declared without quotes...

<?php

$variableName=1;

echo $variableName + 1;

?>

The output to the browser is...

2




A boolean value is declared as either true or false, declared without quotes....

<?php

$variableName=true;

?>


An array value stores multiple text or numeric values...

<?php

$variableName=array('blue', 'green');

?>


A null value is devoid of any value, declared without quotes.

<?php

$variableName=null;

?>


An object value stores variables and functions as properties and methods. Objects, known as classes, are associated with object-orientated programming. Tutorials for PHP classes are on the Classes page.

<?php

$variableName=new ClassName();

?>



SEO Vancouver, Washington
SEO Portland, Oregon
Website Design Vancouver, Washington