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? 6 1648
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
Michael wrote: 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?
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.
a less efficient, but perhaps easier to read or more flexible method
would be something like:
ereg('\[www\](.*)\[/www\]', $text, $arr);
$variable_insid e_www = $arr[1];
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.
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.
with ereg, you can do something similar to this:
while (ereg('\[www\](.*)\[/www\](.*)', $text, $arr))
{
$variables_insi de_www[] = $arr[1];
$text = $arr[2];
} This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: oliver.wulff |
last post by:
Does there exist a class similar to a hashtable which provides a key-value
pair collection. The key and the value has to be a string?
|
by: Surya |
last post by:
I'm using Microsoft.Project.OLEDB.9.0 provider with a datareader to read data from a .mpp file (Microsoft Project plan) from ASP.NET
The problem is All the STRING values, the datareader returns, do not end properly.
I mean, suppose the value its suposed to return is "surya".. But instead it returns "sury
The length of this string is around 256...
|
by: Henrik |
last post by:
In Java you can write something like this. Does anyone know how to do
this in javascript?
"byte b=Integer.parseInt(int value or String).byteValue;"
|
by: Mrozu |
last post by:
Hi
I need function which can show me value of string only TO seted sign.
For example i have string
x="Hello, people"
and i need function which show me string to ",", in this situation
Hello, other example
|
by: Niyazi |
last post by:
Hi all,
What is fastest way removing duplicated value from string array using vb.net?
Here is what currently I am doing but the the array contains over 16000
items. And it just do it in 10 or more minutes.
'REMOVE DUBLICATED VALUE FROM ARRAY +++++++++++++++++
Dim col As New Scripting.Dictionary
Dim ii As Integer = 0
| |
by: Max80 |
last post by:
Hi Everyone,
I have a double value (e.g. 2.00) which I would like to convert to string. Simply returning the value using the .ToString() method trims the 0s after the decimal point. I know that its is possible by doing the following
double d1 = 2.00;
string strValue;
strValue = d1.ToString("#,###.00")
However the...
|
by: pnsreee |
last post by:
Hi All,
I have the following code.
The array @sub_data will contain integers or a string"NO". I have to validate if the array contain integer. If it contain "NO" then no need to validate.
for ($i=1;$i<10;$i++)
{
Tie::CheckVariables->on_error(sub{print "ERROR!"});
tie my...
|
by: hameeduddinasim |
last post by:
Hi
I am trying to get the value from string into string
it is working fine in VB.Net but i facing problem in C#
VB Code
Dim COABANKS() As String
Dim SR3 As StreamReader = File.OpenText(path)
|
by: visweswaran2830 |
last post by:
Hi,
i want to concat int value with string val in vc++..
eg:
for(ii=0;ii<100;ii++)
{
strcpy(fname,"Img");
strcat(fname,CString(ii));
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |