Can use
$validatedValue = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT);
See http://php.net/filter_input and related functions.
More Related Contents:
- Bug unserialize data PHP doesnt work
- URL rewriting with PHP
- Why does PHP consider 0 to be equal to a string?
- Many-to-many relationships examples
- including a remote file in PHP
- On delete cascade with doctrine2
- PHP – If/else, for, foreach, while – without curly braces?
- How to import/include a CSS file using PHP code and not HTML code?
- How to alias a table in Laravel Eloquent queries (or using Query Builder)?
- Do login forms need tokens against CSRF attacks?
- Iterate over each line in a string in PHP
- How can I Use Prepared Statements in CodeIgniter
- Fastest way to add prefix to array keys?
- How to get int instead string from form?
- how to bind multiple parameters to MySQLi query [closed]
- How to get Time Zone through IP Address in PHP [duplicate]
- When *not* to use prepared statements?
- PHP regular expression to match lines starting with a special character
- PHP and Microsoft Access database – Connection and CRUD
- Can I use string concatenation to define a class CONST in PHP?
- Process mathematical equations in php
- PHP Fatal error: Cannot access empty property
- PHP Deprecated: Methods with the same name
- How to remove the fatal error when fetching an assoc array
- Installing pecl and pear on OS X 10.11 El Capitan, macOS 10.12 Sierra, macOS 10.13 High Sierra (< 10.13.3)
- What unit testing in PHP to start [duplicate]
- Save array in mysql database
- facebook error ‘Error validating verification code’
- Best way to internationalize simple PHP website
- PHP/GD – transparent background