velvetInk
velvetInk

Reputation: 368

how to change the value number to a word

I need to display true or false not the number 1

 $permission === 1 ? true: false

Upvotes: 0

Views: 45

Answers (3)

Aravind Pillai
Aravind Pillai

Reputation: 771

Its as simple as

echo "Output : ".($permission == 1) ? 'true': 'false';

Upvotes: 0

user557846
user557846

Reputation:

nearly right:

 $permission= ($permission === 1) ? 'true': 'false';

 echo  $permission;

http://php.net/manual/en/language.operators.comparison.php

First you dont make any assignment =
then you have to make a comparison $permission === 1
then you want the string values "true" or "false"

Upvotes: 1

Anish
Anish

Reputation: 5008

change the boolean to string value

 $permission === 1 ? 'true': 'false';

Upvotes: 0

Related Questions