大桥未久亚洲无av码在线,强奷漂亮少妇高潮 http://m.166276.com/blog 中山php|最優(yōu)網(wǎng)絡(luò) Mon, 13 May 2013 04:56:43 +0000 en hourly 1 http://wordpress.org/?v=3.1.4 php多維數(shù)組的搜索 http://m.166276.com/blog/view-425.html http://m.166276.com/blog/view-425.html#comments Mon, 17 Dec 2012 12:48:04 +0000 lin http://m.166276.com/blog/?p=425 1 php搜索多維數(shù)組的鍵值

如下面例子:

$foo[1]['a']['xx'] = 'bar 1';
$foo[1]['b']['xx'] = 'bar 2';
$foo[2]['a']['bb'] = 'bar 3';
$foo[2]['a']['yy'] = 'bar 4';
$foo[3]['c']['dd'] = 'bar 3';
$foo[3]['f']['gg'] = 'bar 3';
$foo['info'][1] = 'bar 5';

如果要查找 bar 3 怎么進(jìn)行查找呢。有三個(gè)結(jié)果,而這三個(gè)結(jié)果都要,看下面的函數(shù):
-------------------------------------------------------------------------------------------------------------------------------
function array_search_re($needle, $haystack, $a=0, $nodes_temp=array()){
global $nodes_found;
$a++;
foreach ($haystack as $key1=>$value1) {
??? $nodes_temp[$a] = $key1;
??? if (is_array($value1)){???
????? array_search_re($needle, $value1, $a, $nodes_temp);
??? }
??? else if ($value1 === $needle){
????? $nodes_found[] = $nodes_temp;
??? }
}
return $nodes_found;
}
---------------------------------------------------------------------------------------------------------------------------------
這個(gè)函數(shù)就可以把上面要查找到的內(nèi)容全部返回出鍵名來
$result = array_search_re('bar 3', $foo);

print_r($result);

輸出結(jié)果為如下:
Array ( [0] => Array ( [1] => 2 [2] => a [3] => bb )
?????? ?? [1] => Array ( [1] => 3 [2] => c [3] => dd )
?????? ?? [2] => Array ( [1] => 3 [2] => f [3] => gg )
???? ?? )

1 php搜索多維數(shù)組的鍵名

function array_search_key($needle, $haystack){
global $nodes_found;

foreach ($haystack as $key1=>$value1) {
?
?if ($key1=== $needle){
?
??$nodes_found[] = $value1;
???????
?? }
??? if (is_array($value1)){???
????? array_search_key($needle, $value1);
??? }
???
???
}

return $nodes_found;
}
$result = array_search_key('a', $foo);

print_r($result);

輸出結(jié)果為如下:
?

Array
(
??? [0] => Array
??????? (
??????????? [xx] => bar 1
??????? )

??? [1] => Array
??????? (
??????????? [bb] => bar 3
??????? )

??? [2] => Array
??????? (
??????????? [yy] => bar 4
??????? )

)

]]>
http://m.166276.com/blog/view-425.html/feed 743
JS判斷一個(gè)變量是否是數(shù)組以及循環(huán)數(shù)組 http://m.166276.com/blog/view-100.html http://m.166276.com/blog/view-100.html#comments Sat, 13 Aug 2011 18:52:34 +0000 lin http://m.166276.com/blog/?p=100

JS判斷一個(gè)變量是否是數(shù)組的方法

  1. function isArray(o) {
  2. return Object.prototype.toString.call(o) === '[object Array]';
  3. }

//for in循環(huán)數(shù)組

  1. var key;
  2. for (key in array)
  3. {
  4. }

//for循環(huán)數(shù)組

  1. var key;
  2. for (key =0;key< url.length;key++)
  3. {
  4. }
]]>
http://m.166276.com/blog/view-100.html/feed 7
判斷一個(gè)數(shù)組里是否都是空字符串 http://m.166276.com/blog/view-74.html http://m.166276.com/blog/view-74.html#comments Sat, 13 Aug 2011 17:10:57 +0000 lin http://m.166276.com/blog/?p=74

有時(shí)我們要把一個(gè)全為空字符串組成的數(shù)組如:array('','','');當(dāng)成是空對待,因?yàn)槔锩娌缓魏螖?shù)據(jù)

使用empty()顯然是不行的,因?yàn)槔锩姘巳齻€(gè)值,只是這些值都是空字符串,用count()也不可以

那么可以用一種變通的方式,先把數(shù)組用implode轉(zhuǎn)換成字符串,再判斷字符串是否為真就可以了:

$a=array('','');

$a = implode('',$a);i

f($a)'為真';

else echo '為假';

]]>
http://m.166276.com/blog/view-74.html/feed 3
激情综合色综合久久综合| 韩国日本欧美大尺寸suv| 亚洲精品无码永久在线观看男男| 国产丝袜美女一区二区三区| 我和小表妺在车上的乱h| 久久精品国产99国产精品导航| 日产日产自线一二三四2021| 国产精品人人妻人人爽| 亚洲综合色一区二区三区| 久久狠狠高潮亚洲精品| 老师在办公室被躁在线观看| 浓毛妇女老太bbwbbw| 日本无码欧美一区精品久久| 秀婷程仪公欲息肉婷小说| 强开小婷嫩苞又嫩又紧视频| 欧美一区二区三区久久综| 全免费a级毛片免费看网站| 无人在线观看高清完整免费| 冠希实干阿娇13分钟视频在线| 游泳教练在水里含我奶头| 亚洲精华国产精华液| 麻豆成人久久精品二区三区免费| 国产精品天天看天天做夜夜爽| 国产69久久精品成人看| 国产精品jizz在线观看老狼| 再深点灬舒服灬太大了添a片小说| 免费的视频app网站| 99精产国品一二三产区| 黑人勃起太大进不去| 啊轻点灬大ji巴太粗太长了动态| 精品无码国产一区二区三区.| 亚洲色欲色欲www在线丝| 伊人久久大香线蕉av一区二区| 成 人 a v天堂| 18禁老湿机体验区试看120秒| 亚洲国产精品无码久久| 少妇被粗大的猛烈进出69影院一| 久久99精品久久久久久野外| 大肉大捧一进一出的视频| sss极品尤物▌missa▌| 欧美乱码一二三四区|