This article mainly introduces the judgment of negative values in PHP string operations. The example analyzes the judgment skills of negative values in PHP string operations. Friends in need can refer to it.
The details are as follows:
$a = '-1'; $b = (int)$a; $c = is_numeric($a); if ($a) { echo 1; //echo 1 } else { echo 2; } var_dump($b); // int(-1) var_dump($c); // true
The running result output is as follows:
1
int -1
boolean true
Summary:
The logical value of the string '-1' is true;
Summary: The above is all of this article Content, I hope it will be helpful to everyone’s study.
Related recommendations:
PHP Detailed explanation of grouping two-dimensional arrays according to key
PHP page jump to implement delayed jump Transfer method
PHP method of getting page execution time
##
The above is the detailed content of PHP string operation judgment example analysis for negative values. For more information, please follow other related articles on the PHP Chinese website!