Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How can I get X (or another value) from this string "asdfsadf[www]X[/www]"
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Michael  
View profile  
 More options Dec 20 2005, 11:00 am
Newsgroups: comp.lang.php
From: "Michael" <sheepcent...@gmail.com>
Date: 20 Dec 2005 08:00:45 -0800
Local: Tues, Dec 20 2005 11:00 am
Subject: How can I get X (or another value) from this string "asdfsadf[www]X[/www]"
How can I get X (or another value) from this string
"asdfsadf[www]X[/www]",
basically i want to get what ever is in between the [www] tags and
place them in a variable called $www , can anyone help?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Scot McConnaughay  
View profile  
 More options Dec 20 2005, 11:27 am
Newsgroups: comp.lang.php
From: Scot McConnaughay <scot_...@comcast.net>
Date: Tue, 20 Dec 2005 09:27:37 -0700
Local: Tues, Dec 20 2005 11:27 am
Subject: Re: How can I get X (or another value) from this string "asdfsadf[www]X[/www]"
You could probably use the strrpos($string, "[www]") to get the position
of the "X" data. Then use the substr($string, $position_start,
$position_end) function to create your $www variable...

Let me know if that doesn't help.

also, check these pages out :)

http://us2.php.net/manual/en/function.substr.php
http://us2.php.net/manual/en/function.strrpos.php


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael  
View profile  
 More options Dec 20 2005, 12:31 pm
Newsgroups: comp.lang.php
From: "Michael" <sheepcent...@gmail.com>
Date: 20 Dec 2005 09:31:14 -0800
Local: Tues, Dec 20 2005 12:31 pm
Subject: Re: How can I get X (or another value) from this string "asdfsadf[www]X[/www]"
Thanks, this looks like it will work fine, I don't have time to try it
now but I will have a look at it later. I would be interested to know
if there is a simpler way to do it though.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
cyberhorse  
View profile  
 More options Dec 21 2005, 7:06 pm
Newsgroups: comp.lang.php
From: "cyberhorse" <cyberho...@gmail.com>
Date: 21 Dec 2005 16:06:57 -0800
Local: Wed, Dec 21 2005 7:06 pm
Subject: Re: How can I get X (or another value) from this string "asdfsadf[www]X[/www]"
a less efficient, but perhaps easier to read or more flexible method
would be something like:
ereg('\[www\](.*)\[/www\]', $text, $arr);
$variable_inside_www = $arr[1];

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael  
View profile  
 More options Dec 22 2005, 5:58 am
Newsgroups: comp.lang.php
From: "Michael" <sheepcent...@gmail.com>
Date: 22 Dec 2005 02:58:39 -0800
Local: Thurs, Dec 22 2005 5:58 am
Subject: Re: How can I get X (or another value) from this string "asdfsadf[www]X[/www]"
I need a solution that will loop until all of the [www][/www] tags in
string into an array and from there on i have everything sorted.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mara Guida  
View profile  
 More options Dec 22 2005, 6:36 am
Newsgroups: comp.lang.php
From: "Mara Guida" <maragu...@gmail.com>
Date: 22 Dec 2005 03:36:49 -0800
Local: Thurs, Dec 22 2005 6:36 am
Subject: Re: How can I get X (or another value) from this string "asdfsadf[www]X[/www]"

Michael wrote:
> I need a solution that will loop until all of the [www][/www] tags in
> string into an array and from there on i have everything sorted.

If you want to go the regular expression way, have a look at
preg_match_all().

If you want to go the strpos(), substr() way, remember the third
parameter to the strpos() function.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
cyberhorse  
View profile  
 More options Dec 23 2005, 9:23 am
Newsgroups: comp.lang.php
From: "cyberhorse" <cyberho...@gmail.com>
Date: 23 Dec 2005 06:23:33 -0800
Local: Fri, Dec 23 2005 9:23 am
Subject: Re: How can I get X (or another value) from this string "asdfsadf[www]X[/www]"
with ereg, you can do something similar to this:

while (ereg('\[www\](.*)\[/www\](.*)', $text, $arr))
{
$variables_inside_www[] = $arr[1];
$text = $arr[2];


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »