在数组中搜索时如何使用通配符? [英] How do I use wildcards when searching in array?

查看:324
本文介绍了在数组中搜索时如何使用通配符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在数组中搜索时如何使用通配符?至少那就是我的想法

我需要!!


我有这条线:


if($ attribute [0]!=" id")


以上不是100%正确,因为它也应该寻找任何东西

结束与id。例如。 bookid或authorid以及id。


我应该看正则表达式吗?我以前从来没有报道过(好吧不是啰嗦)正常的表情,如果它出现了就不会知道一个

并用湿润的方式打我的脸kipper。


有人能指出我正确的方向。


干杯


Phil

How do I use wildcards when searching in array? At least that''s what I think
I need !!

I have the line:

if ($attribute[0] != "id")

The above is not 100% correct because it should also be looking for anything
ending with id. eg. bookid or authorid aswell as just id.

Should I be looking at regular expressions? I''ve never covered (well not
knowlingly) regular expressions before and wouldn''t know one if it came up
and hit me around the face with a wet kipper.

Could someone point me in the right direction.

Cheers

Phil

推荐答案

attribute [0]!=" id")


以上不是100%正确因为它也应该寻找任何以id结尾的
。例如。 bookid或authorid以及id。


我应该看正则表达式吗?我以前从来没有报道过(好吧不是啰嗦)正常的表情,如果它出现了就不会知道一个

并用湿润的方式打我的脸kipper。


有人能指出我正确的方向。


干杯


Phil
attribute[0] != "id")

The above is not 100% correct because it should also be looking for anything
ending with id. eg. bookid or authorid aswell as just id.

Should I be looking at regular expressions? I''ve never covered (well not
knowlingly) regular expressions before and wouldn''t know one if it came up
and hit me around the face with a wet kipper.

Could someone point me in the right direction.

Cheers

Phil


Phil Latio写道:
Phil Latio wrote:

我应该看正则表达式吗?我以前从来没有报道过(好吧不是啰嗦)正常的表情,如果它出现了就不会知道一个

并用湿润的方式打我的脸腌鱼。
Should I be looking at regular expressions? I''ve never covered (well not
knowlingly) regular expressions before and wouldn''t know one if it came up
and hit me around the face with a wet kipper.



是的,正则表达式可以说是PHP中最有用的工具。如果你没有掌握正则表达式,那么
就不会真正掌握PHP。


你需要的函数是preg_grep我相信。

Yes, regular expression is arguably the most useful tool in PHP. You
wouldn''t have truly mastered PHP if you hadn''t mastered regexp.

The function you need is preg_grep I believe.


Phil Latio写道:
Phil Latio wrote:

如何在数组中搜索时使用通配符?至少那就是我的想法

我需要!!


我有这条线:


if(
How do I use wildcards when searching in array? At least that''s what I think
I need !!

I have the line:

if (


这篇关于在数组中搜索时如何使用通配符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆