PHP for Beginners | PHP data types | PHP resource data type | PHP numerical strings | lesson #3.5

preview_player
Показать описание
A PHP string is considered numeric if it can be interpreted as an int or a float.
Prior to PHP 8.0.0, a string was considered numeric only if it had leading whitespaces, if it had trailing whitespaces then the string was considered to be leading numeric.

Prior to PHP 8.0.0, when a string was used in a numeric context it would perform the same steps as above with the following differences:

The usage of a leading numeric string would raise an E_NOTICE instead of an E_WARNING.
If the string is not numeric, an E_WARNING was raised and the value 0 would be returned.

Homework:
//$foo = 1 + "1.7";
//$foo = 4 + "10.2 Little Piggies";
//$foo = "10.0 pigs " + 1;
//$foo = "10.0 pigs " + 1.0;

Reference:

00:32 ► Checking Homework - strings
04:38 ► Today we will talk about type - numerical strings
05:25 ► Convert from numerical strings to float
11:12 ► Homework for the next lesson
12:48 ► Farewells with wishes

Don't forget pls to click on 'Like', its giving additional motivation to work on channel.
Thank you for watching, for subscription and see you soon.

#mlaautomation #php #boolean #lessons #guide #tutorial #beginner #phpnumericalstring #PHPforBeginners #phpoop #php7 #phpresourcedatatype #php7.4 #allphpdatatypes #phpdatatypes #MLAAutomation
Рекомендации по теме