php处理数组相关

2018-03-01 11:10:10来源:oschina作者:botkenni人点击

分享
$entry = array(
0 => 'foo',
1 => false,
2 => -1,
3 => null,
4 => '',
5 => 0,
);
var_dump(array_filter($entry));//去除项为空或false、null、0的项
$strDelCodes = "A,B,,C,,C,D,,,D,D";
$strDelCodes = explode(",", $strDelCodes);//字符串切割成数组
var_dump($strDelCodes);
$strDelCodes = array_diff($strDelCodes, array(""));//求差集,过滤了共同的值为空的数组项,保留键的名称和顺序
var_dump($strDelCodes);
$strDelCodes = array_unique($strDelCodes);//过滤值相同的数组,但是保留原来的键值对顺序
var_dump($strDelCodes);
$strDelCodes = array_values($strDelCodes);//重新排序键的顺序,如:0 => 'A',1 => 'B',
var_dump($strDelCodes);
G
M
T

Detect languageAfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBengaliBosnianBulgarianCatalanCebuanoChichewaChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDutchEnglishEsperantoEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekGujaratiHaitian CreoleHausaHebrewHindiHmongHungarianIcelandicIgboIndonesianIrishItalianJapaneseJavaneseKannadaKazakhKhmerKoreanLaoLatinLatvianLithuanianMacedonianMalagasyMalayMalayalamMalteseMaoriMarathiMongolianMyanmar (Burmese)NepaliNorwegianPersianPolishPortuguesePunjabiRomanianRussianSerbianSesothoSinhalaSlovakSlovenianSomaliSpanishSundaneseSwahiliSwedishTajikTamilTeluguThaiTurkishUkrainianUrduUzbekVietnameseWelshYiddishYorubaZulu

AfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBengaliBosnianBulgarianCatalanCebuanoChichewaChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDutchEnglishEsperantoEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekGujaratiHaitian CreoleHausaHebrewHindiHmongHungarianIcelandicIgboIndonesianIrishItalianJapaneseJavaneseKannadaKazakhKhmerKoreanLaoLatinLatvianLithuanianMacedonianMalagasyMalayMalayalamMalteseMaoriMarathiMongolianMyanmar (Burmese)NepaliNorwegianPersianPolishPortuguesePunjabiRomanianRussianSerbianSesothoSinhalaSlovakSlovenianSomaliSpanishSundaneseSwahiliSwedishTajikTamilTeluguThaiTurkishUkrainianUrduUzbekVietnameseWelshYiddishYorubaZulu








Text-to-speech function is limited to 200 characters



Options : History : Feedback : Donate
Close

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台