RD> Why use a regular expression?
RD> strpos() will do this just fine.
strpos() will do it just fine, but if you need to use a regular
expression to match a specific pattern and return the location in the
string, preg_match() will also do this when you use the flag
PREG_OFFSET_CAPTURE.
--
Regar
Hello Christian,
Monday, March 29, 2004, 10:28:53 AM, you wrote:
CC> maby I am missing something, but I am trying to find a way to find the N
CC> position/character in a String of a regular expression match. For example,
CC> if I look for the pattern "abba" in 200 character length string, I would
Hi,
maby I am missing something, but I am trying to find a way to find the N
position/character in a String of a regular expression match. For example,
if I look for the pattern "abba" in 200 character length string, I would
like to know where, at what position that match was made. Any ideas? Than
>
> if ($action!='a1' || $action!='a3') //tried == also
> {
> //do stuff
> }
> else
> {
> //do other stuff
> }
>
the logic behind this particular one doesn't work... if it's either not one,
or not the other... it'll always be true... unless both are set to exactly
the same...
the logic if($actio
Isn't there an in_array function you can use?
If (in_array($action, array(a1,a2,a3,a4)) {
// do something
}
else {
// do something else
}
Carl.
-Original Message-
From: andu [mailto:[EMAIL PROTECTED]
Sent: Sunday, August 10, 2003 7:15 PM
To: [EMAIL PROTECTED]
Subject: [PHP] find s
Here's the problem I have:
I have $action which can be anyone of a1, a2, a3, a4.
I tried
if ($action!='a1' || $action!='a3') //tried == also
{
//do stuff
}
else
{
//do other stuff
}
Problem is that if() only seems to take one option so my construct
above doesn't work.
What function can I use to
On Mon, 11 Aug 2003 10:00:57 +1000 (EST)
<[EMAIL PROTECTED]> wrote:
> what exactly is action ?
>
> i usually use a action setup like follows
>
> ?action=update
>
> switch ($_GET['action']) {
>case 'update':
> //do stuff here
>break;
>case 'insert':
> //do stuff here
>
what exactly is action ?
i usually use a action setup like follows
?action=update
switch ($_GET['action']) {
case 'update':
//do stuff here
break;
case 'insert':
//do stuff here
break;
}
very clean
> Here's the problem I have:
> I have $action which can be anyone of a1
.
Thanks Carl, if there is no string function for the job I'll have to
use the array.
>
> -Original Message-
> From: andu [mailto:[EMAIL PROTECTED]
> Sent: Sunday, August 10, 2003 7:15 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] find string
>
> Here'
Hello,
This is a reply to an e-mail that you wrote on Mon, 11 Aug 2003 at
00:25, lines prefixed by '>' were originally written by you.
> Isn't there an in_array function you can use?
> If (in_array($action, array(a1,a2,a3,a4)) {
> // do something
> else {
> // do something else
> Carl.
Make sure
10 matches
Mail list logo