"Each of the variable has truth value embedded in its name"?

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
zak100
New php-forum User
New php-forum User
Posts: 3
Joined: Fri May 24, 2019 1:36 pm

Thu May 30, 2019 8:41 am

Hi,
I am following a tutorial at:
https://www.tutorialspoint.com/php/php ... ypes.htm
It says that:

Each of the following variables has the truth value embedded in its name when it is used in a Boolean context.
Then it gives an example of a variable:

Code: Select all

         
$true_num = 3 + 0.14159;
echo $true_num;
  
When I print $true_num, I am not getting "true".

I thought because the variable $true_num has "true" embedded in its name, it would print "true" value but I am getting following output:
3.14159
What is the advantage of embedding "true" word in a variable's name?

Zulfi.

User avatar
hyper
php-forum Fan User
php-forum Fan User
Posts: 843
Joined: Mon Feb 22, 2016 5:52 pm

Thu May 30, 2019 10:27 am

What is the advantage of embedding "true" word in a variable's name?
None whatsoever. It would cease to be variable if it could only be set as true, that's where constants come in, and that would be pointless.

I haven't looked at the tutorial, but I suspect that there should be more to read which explains their point.

zak100
New php-forum User
New php-forum User
Posts: 3
Joined: Fri May 24, 2019 1:36 pm

Fri May 31, 2019 2:37 pm

Thanks for your time.

Zulfi.

Post Reply