WissensdatenbankPrüfungszentrum
DEDeutsch
Sprache wählen13

CKTIS / PHP

PHP-Typ int

Der Typ int speichert vorzeichenbehaftete Ganzzahlen innerhalb plattformabhängiger Grenzen.

Version: PHP 8.4; repository runtime, production runtime not attested

Syntax

int $count

Der Typ int speichert vorzeichenbehaftete Ganzzahlen innerhalb plattformabhängiger Grenzen. PHP_INT_MIN und PHP_INT_MAX geben sie an. Addition über die Grenze kann float liefern. Das Oktalliteral 010 hat Wert 8, das Hexadezimalliteral 0x10 Wert 16.

$tooLarge = PHP_INT_MAX + 1;
echo json_encode([010, 0x10, is_int(PHP_INT_MAX), is_float($tooLarge)]);
[8,16,true,true]

Beispiele

<?php
$tooLarge = PHP_INT_MAX + 1;
echo json_encode([010, 0x10, is_int(PHP_INT_MAX), is_float($tooLarge)]);

Ergebnis

[8,16,true,true]

Quellen