An array-php Tutorial

Source: Internet
Author: User
Ask an array question var_export to get the result of $ varmysql_fetch_array (mysql_query ($ SQL): array (& nbsp; 0 & gt; a,) array (& nbsp; 0 & gt; b,) array (& nbsp; 0 & gt; c,) if the in_array function is used to match a field $ c, the ec will ask an array question.
Var_export returns the result of $ var = mysql_fetch_array (mysql_query ($ SQL:
Array (
0 => 'A ',
)
Array (
0 => 'B ',
)
Array (
0 => 'C ',
)

If the in_array function is used to match a field $ c, if it fails, echo N.

How do I express this expression?







------ Solution --------------------
PHP code
$ Arr = array (0 => array (0 => 'question three ', 'detail' => 'question three ',), 1 => array (0 => 'question four ', 'detail' => 'question four ',), 2 => array (0 => 'question Five ', 'detail' => 'question Five',),); $ test = array (0 => 'question three ', 'detail' => 'question three ',); if (in_array ($ test, $ arr) {echo 'yes ';}
------ Solution --------------------
Foreach ($ var as $ key => $ val ){
Foreach ($ val as $ k =>$ v ){
If (in_array ('C', $ v )){
Echo "C ";
} Else {
Echo "N ";
}
}

}
I don't know what kind of array you are using. you can try it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.