数组匹配并在php中显示(array matching and display in php)
我正在使用PHP脚本来实现这个...
$keyword=array('local news','art','local','world','tech','entertainment','news','tech','top stories','in the news','front page','bbc news','week in a glance','week in pictures','top stories'); //$keyword has predefined array of strings $all_meta_tags=get_meta_tags("http://abcnews.go.com/"); $array=$all_meta_tags['keywords'];//store 'keyword' attribute values in $keyword_meta
现在我必须匹配$ array的内容和$ keyword .....结果应该给我$ array中匹配的项目,这些项目存在于$ keyword中
任何帮助PLZ ......?
数组匹配/交集是否可以不区分大小写? 我的意思是如果$ keyword = array('local news'); $ array ='本地新闻,国际新闻'; var_dump(array_intersect(preg_split('/,\ s * /',$ array),$ keyword));
然后它不会匹配'本地新闻'...你能告诉我如果有可能吗?
i am using PHP scripts to implement this...
$keyword=array('local news','art','local','world','tech','entertainment','news','tech','top stories','in the news','front page','bbc news','week in a glance','week in pictures','top stories'); //$keyword has predefined array of strings $all_meta_tags=get_meta_tags("http://abcnews.go.com/"); $array=$all_meta_tags['keywords'];//store 'keyword' attribute values in $keyword_meta
Now i have to match contents of $array with $keyword.....the results should give me matched items of $array which are present in $keyword
any help plz...?
can array matching/intersection be done case insensitively?? i mean if $keyword=array('local news'); $array = 'Local News, International News'; var_dump(array_intersect(preg_split('/,\s*/', $array), $keyword));
then it won't match 'Local News'...can you tel me hw to do it if it is possible??
原文:https://stackoverflow.com/questions/5229256
最满意答案
尝试
bquote
:lapply(as.numeric(2:7), function(x) bquote(10^.(x)))
Try
bquote
:lapply(as.numeric(2:7), function(x) bquote(10^.(x)))
相关问答
更多-
你需要的是matcher.find()和Long.valueOf() : public class Main { public static void main(String[] args) { System.out.println(getsequencenumber("Bladds seq 1910428391283 ldskgj")); } public static long getsequencenumber(String Packet){ ...
-
R中的重复序列(Sequence of Repeated Values in R)[2023-12-31]
你错过了each=参数rep() : R> n <- 3 R> rep(1:5, each=n) [1] 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 R> 所以你的例子可以用简单的方法来完成 R> rep(1:8, each=20) You missed the each= argument to rep(): R> n <- 3 R> rep(1:5, each=n) [1] 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 R> so your example c ... -
r:数值序列对(r: pair of values sequence)[2023-02-09]
如果你想要一个列表,你可以这样做: s1 = seq(as.Date('2014-02-01'), as.Date('2014-8-31'), by='1 month') Map(c, head(s1, -1), tail(s1, -1)) #[[1]] #[1] "2014-02-01" "2014-03-01" #[[2]] #[1] "2014-03-01" "2014-04-01" #[[3]] #[1] "2014-04-01" "2014-05-01" #[[4]] #[1] "2014 ... -
len(prefix) <= len(sequence) and all(i==j for i, j in zip(prefix, sequence)) len(prefix) <= len(sequence) and all(i==j for i, j in zip(prefix, sequence))
-
我认为Gene的答案很可能是一种方式! 但是如果你想使用序列表达式来遍历已有序列的元素,你可以这样写: let takeWhileNonException (input:seq<_>) = seq { use ps = input.GetEnumerator() while (try ps.MoveNext() with _ -> false) do yield ps.Current } 可悲的是,你不能只for循环或yield!而换行yield! 语句与try ..因为(如你所说), ...
-
尝试bquote : lapply(as.numeric(2:7), function(x) bquote(10^.(x))) Try bquote: lapply(as.numeric(2:7), function(x) bquote(10^.(x)))
-
在MATLAB中的序列(Sequence in MATLAB)[2022-09-29]
你有一个几何系列,其中r = -2。 要生成2,-4,8,-16,32,请输入: >>-(-2).^[1:5] 2, -4, 8, -16, 32 您可以相应地更改5的值。 You are having a geometric series where r = -2. To produce 2, -4, 8, -16, 32, type this: >>-(-2).^[1:5] 2, -4, 8, -16, 32 You can change the value of 5 accordingly ... -
将v转换为factor并返回到numeric可以解决问题 as.numeric(as.factor(v)) #[1] 1 4 1 2 2 3 5 4 5 Converting v to factor and back to numeric could do the trick as.numeric(as.factor(v)) #[1] 1 4 1 2 2 3 5 4 5
-
是的,它叫做“Tail Call Optimization”,请看这里: http : //blogs.msdn.com/b/chrsmith/archive/2008/08/07/understanding-tail-recursion.aspx Seq也很懒,所以它的第500个成员将会在您不必在程序中访问它之前不要进行评估,例如: let elm = Seq.nth 500 fibSeq Yes, it's called "Tail Call Optimization" See here: http: ...
-
也许下面的替代方案之一是可以接受的。 (let [buffer-endianness (.order buffer) _ (.order buffer endianness) result (cond (= width 1) (.get buffer) (= width 2) (.getShort buffer) (= width 4) (.getInt buffer) ...