Data Types
IT Notes → PHP @ December 22, 2020
- The seven types are:
- Scalar = string, integer, float, boolean.
- Composite = array, object.
- Additional Types = NULL, resource.
- PHP considers the number false, 0, 0.000, 0, arr[], NULL to be false, and everything else to be true.
- Integers are stored in 2s complement system where the negative numbers are represented by the two’s complement of the absolute value (-2 = 2s complement of 2 = 2s complement of absolute value of 2 = 2s complement of 0010 => 1101+1=> 1110).
- For boolean XOR is denoted by ^ which is set if they are set in either operand and unset otherwise. Complement of 0 is 1 because ~0000 = 1111. This is 2s complement of 1111 => – (0000+1) = – (0001) = -1. So, in PHP ~N = -N-1.
- For modules the sign is that of division and value as if it is applied on positive operands.
- NULL means either not initialized or is initialized with special value NULL.
- Resource handles external resources.
Subscribe
Login
0 Comments