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

Example Analysis of php NULL and Resource RESOURCE data types

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

Share

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

This article mainly introduces php NULL and resource RESOURCE data type example analysis, has a certain reference value, interested friends can refer to the next, I hope you read this article after a lot of gains, the following let Xiaobian take you to understand.

1, NULL

Note: A special NULL value indicates that a variable has no value. The only possible value for NULL is NULL.

In PHP, there are only cases where variables are defined and assigned, there is no definition of no assignment. At this point, you need to create a variable that doesn't know what value is stored. At this point, NULL can be used to create variables.

//null type $a = null;if(empty($a)){ echo 'empty'; //output is empty}

php will assume NULL if:

1. is assigned NULL

2. Not yet assigned

3. unset()

NULL is often used in scenarios:

Default values for the shape of a function

function test($a=null,$b=null){ Second, resource.

Reference php external content, this time the type is resources, resources are created and used through special functions.

$link = mysql_connect ('127.0.0.1','root',' root'); Thank you for reading this article carefully. I hope that Xiaobian will share the "example analysis of php NULL and resource RESOURCE data types". This article is helpful to everyone. At the same time, I hope you will support it a lot. Pay attention to the industry information channel. More relevant knowledge is waiting for you 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