Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Which is the permanent conversion function of the php data type

2025-02-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "which is the permanent conversion function of php data type". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn which is the permanent conversion function of the php data type.

The persistent conversion function of the php data type is "settype ()". The settype () function is used to set the type of the variable, which permanently changes the data type of the variable itself; the syntax "settype ($var,$type)" and the parameter "$type" specify the target data type to convert.

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

In PHP, there are many functions that implement data type conversion: intval (), floatval (), boolval (), strval (), settype ().

However, the intval (), floatval (), boolval (), strval () functions do not change the type of the converted variable itself, but by assigning the new type of data to the new variable, the type and value of the original variable remain unchanged. It is not possible to convert permanently.

Settype () can permanently change the data type of the variable itself, syntax:

Settype ($var,$type)

Sets the type of the variable $var to $type.

The possible values of $type are:

"boolean" (or "bool", starting with PHP 4.2.0)

"integer" (or "int", starting with PHP 4.2.0)

"float" (available only after PHP 4.2.0, "double" used in older versions is now disabled)

"string"

"array"

"object"

"null" (since PHP 4.2.0)

Example:

At this point, I believe you have a deeper understanding of "which is the permanent conversion function of the php data type". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report