How to convert boolean to string by php
This article introduces php how to convert boolean into a string, the content is very detailed, interested friends can use for reference, I hope it can be helpful to you.
Php converts boolean into a string: 1, add the target type "(string)" enclosed in parentheses before the variable of boolean type, syntax "(string) $bool"; 2, use strval () function, syntax "strval ($bool)".
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
In PHP, there are many ways to convert boolean type to string type. Here are two ways:
Precede the variable with the target type enclosed in parentheses (string)
Use the strval () function
Example:
Output result:
About php how to convert boolean into a string to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.