Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

one

One is the 1 integer. One is part of the truthy values: it is the equivalent of true.

Multiplying, or dividing, a string by 1 turns it into an integer, just like the cast operator (int) does.

1 is one of the two valid index when building a callback with an array, along with 0.

1 is a classic magic number, although it has so many uses that it is usually look over, as generating too many false positives or scattered issues.

<?php

    $one = 1;

    $four = 4 * 1;

?>

Documentation

See Also