Types
Booleans
String "0" will be not FALSE but TRUE when being converted to Boolean.
Integers
the maximum value of an integer is about 9.2*1018 in PHPoC.
Classes
Not support for classes.
Arrays
Features are as follows:
- Initial value should be assigned in their declaration.
- Only number is acceptable to KEY value.
- Not support for array generation or functional call with a square bracket.
- Examples
<?php
// Example 1
$var0 = array(3, 7, "array", "test");
$int0 = $var0[0] + $var0[1];
$str0 = $var0[2] . " " . $var0[3];
?>
<?php
// Example 2
$int0 = 3;
$int1 = 7;
$str0 = "array";
$str1 = "test";
$var1 = array($int0, $int1, $str0, $str1);
?>
<?php
// Example 3
$str0 = "array test";
$str0[6] = "T";
$str0[7] = "E";
$str0[8] = "S";
$str0[9] = "T";
echo $str0; // Output : array TEST
?>
Null
Not support for Null.
Type Juggling
- Arithmetic Operator: addition(+), subtraction(-), multiplication(*), division(/)
Types |
Boolean |
Integer |
Floating Point |
String |
Boolean |
X |
X |
X |
X |
Integer |
X |
O |
O |
X |
Floating Point |
X |
O |
O |
X |
String |
X |
X |
X |
X |
- Arithmetic Operator: the rest(%)
Types |
Boolean |
Integer |
Floating Point |
String |
Boolean |
X |
X |
X |
X |
Integer |
X |
O |
X |
X |
Floating Point |
X |
X |
X |
X |
String |
X |
X |
X |
X |
- Bitwise Operator: AND(&), OR(|), XOR(^), left shift(<<), right shift(>>)
Types |
Boolean |
Integer |
Floating Point |
String |
Boolean |
X |
X |
X |
X |
Integer |
X |
O |
X |
X |
Floating Point |
X |
X |
X |
X |
String |
X |
X |
X |
X |
- Bitwise Operator: compliment(~)
Boolean |
Integer |
Floating Point |
String |
X |
O |
X |
X |
- Comparison Operator: less than(<), greater than(>), less or equal(<=), greater or equal(>=)
Types |
Boolean |
Integer |
Floating Point |
String |
Boolean |
X |
X |
X |
X |
Integer |
X |
O |
O |
X |
Floating Point |
X |
O |
O |
X |
String |
X |
X |
X |
O |
- Comparison Operator: equal(==), not equal(!=), not equal(<>)
Types |
Boolean |
Integer |
Floating Point |
String |
Boolean |
O |
X |
X |
X |
Integer |
X |
O |
X |
X |
Floating Point |
X |
X |
O |
X |
String |
X |
X |
X |
O |
- Increment/Decrement Operator: increment(++), decrement(--)
Boolean |
Integer |
Floating Point |
String |
X |
O |
X |
X |
- Logical Operator: AND(&&), OR(||)
Types |
Boolean |
Integer |
Floating Point |
String |
Boolean |
O |
O |
X |
O |
Integer |
O |
O |
X |
O |
Floating Point |
X |
X |
O |
X |
String |
O |
O |
X |
O |
Boolean |
Integer |
Floating Point |
String |
O |
O |
X |
O |
- Sign Operator: positive(+), negative(-)
Boolean |
Integer |
Floating Point |
String |
X |
O |
O |
X |
- Expression in Control Structure: if, for, (do) while
Boolean |
Integer |
Floating Point |
String |
O |
O |
X |
O |
- printf function output format
Types |
Boolean |
Integer |
Floating Point |
String |
%b, %o, %x |
X |
O |
X |
X |
%d, %u |
X |
O |
X |
X |
%c |
X |
O |
X |
X |
%e, %f, %g |
X |
X |
O |
X |
%s |
X |
X |
X |
O |