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

must be a finite value

Description

This error is raised when a parameter was provided with an infinite value.

Infinite values are generated by maths functions such as atan or log, and also with the INF and NAN constants. Infinite values are considered to be typed float.

For example, stream_socket_client() and stream_socket_accept() require a $timeout parameter, and it is tempting, but not valid, to provide INF.

Example

<?php

$fp = stream_socket_client(tcp://www.example.com:80, $errno, $errstr, INF);

?>

Alternatives

  • Use a very large, but finite float value, such as PHP_FLOAT_MAX, which will be valid until the end of the universe, even in nanoseconds.