Get the App
SLTechnology News&Howtos  ›  Development  › 

How php converts strings to bool types

Shulou Source: shulou.com Published: 2022-06-03 15:24:39 10月02日 Update

This article mainly explains "how php converts strings to bool types". The explanation in this article is simple and clear and easy to learn and understand. please follow the editor's ideas to study and learn "how php converts strings to bool types".

Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

Method 1: add the target type (bool) or (boolean) enclosed in parentheses before the string variable to be converted

Output result:

Method 2: use the boolval () function

Boolval (): used to get the Boolean value of the variable

Output result:

Thank you for your reading, the above is the content of "how php converts strings to bool types". After the study of this article, I believe you have a deeper understanding of how php converts strings to bool types, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Characters strings types learning content variables methods results output functions that is Boolean ideas situations parentheses tutorials articles more environment computer Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Information MariaDB Huawei Xiaomi