Fellipe Sanches' website

Author: F. Sanches

  • What’s new in php 7

    Topic index on this page

    Spaceship operator <=>

    The spaceship operator <=> is used for comparing two expressions.

    It returns:

    -1 when the left side is smaller

    0 when the left side is equal

    1 when the left side is greater

    Underscores in Integer & Floating notation

    Like always, whole number, such as 3, 14, 22, or 2025 should not contain commas. However, since PHP 7.4, you can use underscores between digits for better readability, for example, 2_025. The PHP engine will remove the underscores automatically.

    Floating point numbers (also known as floats, doubles, or real numbers) can be specified using decimal point, such as Pi 3.14159265359 or 2500.75, likewise, since PHP 7.4, you can use underscores between digits for better readability, for example, 2_500.75.