<?php
int print ( str $arg );
where,
$arg = ELEMENT to be printed
?>
<?php
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SOME VALID VARIABLE EXAMPLES
STRINGS: INTERNAL
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
print $_SERVER['REMOTE_ADDR'];
// GETS THE REMOTE ADDRES (IP)
print $_SERVER['HTTP_USER_AGENT'];
// GETS THE USER AGENT (BROWSER)
print $_SERVER['HTTP_ACCEPT_LANGUAGE'];
// GETS THE ACEPTED LANGUAGE
?>
<?php
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SOME VALID VARIABLE EXAMPLES
STRING: USER-DEFINED
All VARIABLES after the value assignment
must end with a SEMICOLON
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$xyz = "\"STRING DELIMITED BY DOUBLE QUOTATION MARKS\"";
$str0 = '\'STRING DELIMITED BY SINGLE QUOTATION MARKS\'';
$carÇ = '\'STRING DELIMITED BY SINGLE "QUOTATION MARKS"\'';
$_alo = "\"STRING DELIMITED BY DOUBLE 'QUOTATION MARKS'\"";
$rquo = " » ";
$str02a = "1AnVXY234";
$str02b = "1234567";
// HEREDOC
$str02c = <<<EOD
Easy come, easy go.
If you can’t beat them, join them.
Life begins at forty.
Two heads are better than one.
EOD;
$str02d = <<<EOT
In PHP there are TWO types
of variables:
INTERNAL, (predefined).
OF USER: (user-defined).
EOT;
// NOWDOC
$str02e = <<<'EOD'
Easy come, easy go.
If you can’t beat them, join them.
Life begins at forty.
Two heads are better than one.
EOD;
$str02f = <<<'EOT'
In PHP there are TWO types
of variables:
INTERNAL, (predefined).
OF USER: (user-defined).
EOT;
print $xyz . '<br><br>' . $str0 . '<br><br>' .
$carÇ . '<br><br>' . $_alo . '<br><br>';
print $rquo . '<br><br>' . $str02a . '<br><br>' .
$str02b . '<br><br>';
print $str02c . '<br><br>' . $str02d . '<br><br>';
print $str02e . '<br><br>' . $str02f;
?>
<?php
/* - - - - - - - - - - - - - - - - - - - - - - - - -
SOME VALID CONSTANT EXAMPLES
STRINGS: INTERNAL
- - - - - - - - - - - - - - - - - - - - - - - - - */
print PHP_VERSION;
// GETS THE ACTUAL PHP VERSION
print PHP_EOL;
// SPECIFIES THE END OF LINE
print (PHP_DATADIR);
// SPECIFIES THE DATA DIRECTORY
?>
<?php
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SOME VALID CONSTANT EXAMPLES
STRINGS: USER-DEFINED
To establish a CONSTANT USER-DEFINED value
is necessary, before, to use de define statement.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
define('KONST01', 'Haste makes waste. ', FALSE);
// FALSE as default KONST01 ≠ konst01
print KONST01 . '<br><br>';
define('KONST02', 'Haste makes waste. ', TRUE);
// TRUE as default KONST02 = konst02
print KONST02 . '<br><br>' . konst02;
?>
<?php
/* - - - - - - - - - - - - - - - - - - - - -
SOME VALID VARIABLE EXAMPLES
NUMBERS: INTERNAL
- - - - - - - - - - - - - - - - - - - - - */
print ($_SERVER['REQUEST_TIME']);
print '<br><br>' . ($_SERVER['REQUEST_TIME_FLOAT']);
?>
<?php
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SOME VALID VARIABLE EXAMPLES
NUMBERS: USER-DEFINED
All VARIABLES after the value assignment
must end with a SEMICOLON
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
// INTEGER
$x01p = 220;
$x01n = -220;
print '$x01p = ' . ($x01p) . '<br>$x01n = ' .
($x01n) . '<br><br>';
// FLOAT
$x02p = 123.456;
$x02n = -123.456;
print ('$x02p = ' . $x02p . '<br>$x02n = ' .
$x02n . '<br><br>');
// CIENTIFIC NOTATION
$x03p = 1E19;
$x04p = 1.6e-19;
print ('$x03p = ') . ($x03p) . ('<br>$x04p = ') .
($x04p) . ('<br><br>');
// HEXADECIMAL NOTATION ->
// -> (20b)base 16 = (20B)base 16 = (523)base 10
$x05p = 0x20b;
$x06p = 0X20B;
print '$x05p = ' . $x05p . '<br>$x06p = ' .
$x06p . '<br><br>';
// OCTAL NOTATION ->
// -> (1023)base 8 = (531)base 10
$x07p = 01023;
print '$x07p = ' . $x07p . '<br><br>';
// BINARY NOTATION ->
// -> (0011)base 2 = (3)base 10
$x08p = 0b0011;
// Available since PHP 5.4.0
print '$x08p = ' . $x08p . '<br>';
?>
<?php
/* - - - - - - - - - - - - - - - - - - - - - -
SOME VALID CONSTANT EXAMPLES
NUMBERS: INTERNAL
- - - - - - - - - - - - - - - - - - - - - - */
M_E;
// VALUE of e
M_PI;
// VALUE of PI
M_SQRT2;
// SQUARE ROOT of 2
print (M_E . '<br><br>' . M_PI . '<br><br>' .
M_SQRT2 . '<br><br>');
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SOME VALID CONSTANT EXAMPLES
NUMBERS: USER-DEFINED
All CONSTANT after the value assignment
must end with a SEMICOLON.
To establish a CONSTANT USER-DEFINED value
is necessary, before, to use de define statement.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
// DECIMAL NOTATION
define('KONST03', 123456789);
print 'KONST03 = ' . KONST03 . '<br><br>';
// OCTAL NOTATION ->
// -> (1023)base 8 = (531)base 10
define('KONST04', 0123);
print 'KONST04 = ' . KONST04 . '<br><br>';
// HEXADECIMAL NOTATION ->
// -> (20b)base 16 = (20B)base 16 = (523)base 10
define('KONST05', 0X20B);
print 'KONST05 = ' . KONST05 . '<br><br>';
// BINARY NOTATION ->
// -> (0011)base 2 = (3)base 10
define('KONST06', 0b0011, TRUE);
// Available since PHP 5.4.0
print 'KONST06 = ' . KONST06 . '<br>';
print 'konst06 = ' . konst06 . '<br><br>';
/* - - - - - - - - - - - - - - - - - - - - - - - -
SOME VALID CONSTANT EXAMPLES
NUMBERS: INTERNAL
- - - - - - - - - - - - - - - - - - - - - - - - */
// INTEGER
print "Smallest INTEGER number = " .
PHP_INT_MIN . '<br><br><br>';
// -2147483648(32 bit)
// or
// -9223372036854775808(64 bit)
// Available since PHP 7.0.0
print "Largest INTEGER number = " .
PHP_INT_MAX . '<br><br>';
// 2147483647(32 bit)
// or
// 9223372036854775807(64 bit)
// Available since PHP 5.0.5
print PHP_MINOR_VERSION . '<br><br>';
// Current minor version of PHP
print PHP_MAJOR_VERSION . '<br><br><br>';
// Current major version of PHP
// Available since PHP 5.2.7
// FLOAT
print "Smallest FLOATING POINT number = " .
PHP_FLOAT_MIN . '<br><br>';
// Smallest floating point number
print "Largest floating point number = " .
PHP_FLOAT_MAX . '<br><br>';
// Largest floating point number
// Available since PHP 7.2.0
/* - - - - - - - - - - - - - - - - - - - - - - - - - -
Generally, Boolean data
is used in routines which
involve decision making
We will see how, in the
near future in this tutorial
- - - - - - - - - - - - - - - - - - - - - - - - - - */
$tr01 = true;
$TR01 = TRUE;
print '$TR01 = ' . $TR01 . '<br><br>';
$fl01 = false;
$FL01 = FALSE;
define('tr01a', false, true);
print 'tr01a = ' . tr01a;
define('FL01a', FALSE);
?>
<?php
PHP_VERSION;
PHP_MAJOR_VERSION;
PHP_MINOR_VERSION;
print ('Current PHP version: ' .
PHP_VERSION .
'<br><br>Major number of this version: ' .
PHP_MAJOR_VERSION .
'<br><br>Minor number of this version: ' .
PHP_MINOR_VERSION .
'<br><br>');
?>
<?php
$v09a = 5.455_052e-10;
// float
$v09b = 300_482_381;
// decimal
$v09c = 0xBBFF_3E48;
// hexadecimal
$v09d = 0b0101_1111;
// binary
// Representations available since the PHP 7.4.0
print '$v09a = ' . $v09a;
print '<br><br>$v09b = ' . $v09b;
print '<br><br>$v09c = ' . $v09c;
print '<br><br>$v09d = ' . $v09d;
?>
<?php
print 'PHP: ' . PHP_VERSION . '<br><br>';
$case_insensitivef = false;
$case_insensitivet = true;
print($case_insensitivef);
print '<br><br>';
define("const01", 'Constante 01', $case_insensitivef);
print const01 . '<br><br>';
define("CONST01", 'CONSTANTE 01', $case_insensitivef);
print CONST01 . '<br><br>';
print($case_insensitivet);
print '<br><br>';
define("const01", 'Constante 01', $case_insensitivet);
print const01 . '<br><br>';
define("CONST01", 'CONSTANTE 01', $case_insensitivet);
print CONST01 . '<br><br>';
?>