From f542ee30a2d3a28390cf380e72c74b6bc00c699f Mon Sep 17 00:00:00 2001 From: "hridoy.dev" Date: Sun, 31 Mar 2024 22:21:59 +0600 Subject: [PATCH] feat: numbers --- 07_numbers.php | 101 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 07_numbers.php diff --git a/07_numbers.php b/07_numbers.php new file mode 100644 index 0000000..bcd8b5e --- /dev/null +++ b/07_numbers.php @@ -0,0 +1,101 @@ +'; +echo '===== Check integer ===='; +echo '
';
+
+/*
+ * Check integer
+ * is_int()
+ * is_integer() - alias of is_int()
+ * is_long() - alias of is_int()
+ * */
+
+$x = 5985;
+var_dump(is_int($x));
+
+$y = 59.85;
+var_dump(is_int($y));
+
+
+echo '
';
+echo '===== Check Float ====';
+echo '
';
+
+/*
+ * Check Float
+ * is_float()
+ * is_double() - alias of is_float()
+ * */
+
+$x = 10.365;
+var_dump(is_float($x));
+
+echo '
';
+echo '===== Check Numeric ====';
+echo '
';
+
+
+/*
+ * Check Numeric
+ * is_numeric()
+ * */
+
+$x = 5985;
+var_dump(is_numeric($x));
+
+$x = "5985";
+var_dump(is_numeric($x));
+
+$x = "59.85" + 100;
+var_dump(is_numeric($x));
+
+$x = "Hello";
+var_dump(is_numeric($x));
+
+echo '
';
+echo '===== Check Infinity ====';
+echo '
';
+
+/*
+ * Check Infinity
+ * is_finite()
+ * is_infinite()
+ * */
+
+$x = 1.9e411;
+var_dump($x);
+var_dump(is_finite($x));
+var_dump(is_infinite($x));
+
+echo '
';
+echo '===== Check NaN ====';
+echo '
';
+
+/*
+ * Check NaN
+ * is_nan()
+ * */
+
+$x = acos(8);
+var_dump($x);
+var_dump(is_nan($x));