Get the App
SLTechnology News&Howtos  ›  Development  › 

How to convert boolean to string by php

Shulou Source: shulou.com Published: 2022-06-03 08:02:15 11月15日 Update

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.

Tags: Types variables characters strings methods contents functions parentheses more goals syntax use help good interests multiple boys buddies tutorials articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker vpn Redmi Shulou Tech Info Microsoft