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

How does php determine whether an array value exists

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

Share

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

This article introduces the knowledge of "how to determine the existence of array values by php". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

In php, you can use the in_array () function to determine whether an array value exists, which searches for the existence of a specified value in the array, with the syntax "in_array (search,array,type)"; returns TRUE if the value exists, FALSE otherwise.

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

In php, you can use the in_array () function to determine whether an array value exists.

The in_array () function searches for the existence of a specified value in an array.

Syntax:

In_array (search,array,type)

Search is required. Specifies the value to search in the array.

Array is required. Specifies the array to search.

Type is optional. If you set this parameter to true, check that the data searched is of the same type as the value of the array.

Return value: returns TRUE if a value is found in the array, FALSE otherwise.

Description:

If the search parameter is a string and the type parameter is set to TRUE, the search is case sensitive.

Returns true if the given value search exists in the array array. If the third parameter is set to true, the function returns true only if the element exists in the array and the data type is the same as the given value.

If no arguments are found in the array, the function returns false.

Example: determine whether the array value "Glenn" exists

That's all for "how php determines whether an array value exists". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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