Search
 
SCRIPT & CODE EXAMPLE
 

PHP

PHP Numeric String

/*
The PHP is_numeric() function can be used to find whether a variable is 
numeric. The function returns true if the variable is a number or a 
numeric string, false otherwise.
*/

#How to check if the variable is numeric

<?php
$x = 24523;
var_dump(is_numeric($x));

$x = "24523";
var_dump(is_numeric($x));

$x = "124.14" + 100;
var_dump(is_numeric($x));

$x = "Random Text";
var_dump(is_numeric($x));
?>
  
/*This outputs 
bool(true)
bool(true)
bool(true)
bool(false)
*/
Comment

PREVIOUS NEXT
Code Example
Php :: get post url from post id wordpress 
Php :: append file in php 
Php :: get taxonomies for custom post type 
Php :: strtotime format 
Php :: how to separate integer from string in php 
Php :: laravel routing controller get and post method 
Php :: file to binary php 
Php :: time to string in php 
Php :: php trim string if longer than 
Php :: sleep php 
Php :: how to get a particular column in laravel 8 
Php :: laravel echo query 
Php :: php randon integer 4 digit 
Php :: wp logs 
Php :: how to display user id from a function on a wordpress page 
Php :: laravel model limit 
Php :: laravel in array blade 
Php :: define("ROOT PATH", __DIR__); 
Php :: simple localhost php 
Php :: routing code in drupal 8 
Php :: php for each schleife 
Php :: change php version in linux 
Php :: PHP (WordPress) - Increase Maximum Upload File Size 
Php :: time php 
Php :: php strftime 
Php :: phpcs ignore line warning 
Php :: log data into file php 
Php :: codeingiter 3 where in 
Php :: php mysql search database and display results 
Php :: how to define function in php 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =