Home  >  Article  >  Backend Development  >  How to secretly get values ​​from an array_PHP Tutorial

How to secretly get values ​​from an array_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 10:51:09887browse



Question
How to secretly get values ​​from an array
Solution
For example, select count(*).....The result should be only one value. Now there is only such a value in an array. How to take it out?
Prerequisite: If you don’t know the array key name, you cannot use numerical index


Reference answer
array_values
Reference answer
Please take a look at the usage of mysql_result() in the manual. It is more convenient to obtain a single value.
Reference answer
Original post published by xdevil on 2009-1-2 23:36 [url=http://bbs.111cn.cn/redirect.php?goto=findpost&pid=812883&ptid=100203]Link tag [img]http://bbs. 111cn.cn/images/common/back.gif[/img][/url]
array_values ​​
This function still returns an array, and the value is not taken out directly
Reference answer
I don’t know what to say,,
Reference answer
mysql_fetch_row() //
$arr[0];
?>

Don’t forget: the use of mysql_fetch_row..
Reference answer
current
(PHP 3, PHP 4, PHP 5)

current -- Returns the current cell in the array
Description
mixed current (array &array)
Reference answer
The original post was published by An at 2009-1-2 23:54 [url=http://bbs.111cn.cn/redirect.php?goto=findpost&pid=812910&ptid=100203]Link tag [img]http://bbs. 111cn.cn/images/common/back.gif[/img][/url]


Don’t forget: the use of mysql_fetch_row..
Unfortunately, I don’t use mysql
Reference answer
The original post was published by ddm on 2009-1-2 23:59 [url=http://bbs.111cn.cn/redirect.php?goto=findpost&pid=812916&ptid=100203]Link tag [img]http://bbs. 111cn.cn/images/common/back.gif[/img][/url]
current
(PHP 3, PHP 4, PHP 5)

current -- Returns the current cell in the array
Description
mixed current (array &array)
Thank you all very much, this is what I want [img]http://www.111cn.cn/bbs/images/smilies/default/loveliness.gif[/img]
Reference answer
There are many methods, such as:

array_shift

array_pop

This function can achieve the function you want.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632585.htmlTechArticleThe problem is how to get the value from the array in a mysterious way, such as select count(*).....The result should be There is only one value. Now there is only one value in an array. How to take it out...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:mb_substr_PHP tutorialNext article:mb_substr_PHP tutorial