$myVar = 123; if (t3lib_div::testInt($myVar)) { echo "My var is an integer!"; } else { echo "My var is not an integer!"; }
$userInput = $_POST['input']; if (t3lib_div::testInt($userInput)) { echo "Your input is an integer!"; } else { echo "Your input is not an integer!"; }In this example, the testInt function is used to check if a user's form input is an integer or not. If it is, the message "Your input is an integer!" is printed; otherwise, the message "Your input is not an integer!" is printed. Package library: TYPO3 CMS framework.