Hello,
Replacing the key : #0001# within $data doesn't work!! I want to replace it
with a link!
Any sugestions?
Thanx,
InSeCo
*Example of the problem :*
<?php
$data = "abcdefghijklmnopqrstuvwxyz #0001# abcdefghijklmnopqrstuvwxyz<BR>
\n";
$data = $data."abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz<BR>
\n";
$data = $data."abcdefghijklmnopqrstuvwxyz #0001#
abcdefghijklmnopqrstuvwxyz<BR> \n";
$repldata = "<A href=link.html>link</a>";
$replold = "#0001#";
echo "<B>Original Data</B><BR>$data;<HR>";
echo "<B>Data to replace :</B> $replold <HR>";
echo "<B>Replace data with :</B> $repldata <HR>";
str_replace($replold, $repldata , $data);
echo "<B>New Data</B><BR>$data;<HR>";
?> 4 2232
"InSeCo" <In****@news.news> kirjoitti
viestissä:42*********************@news.xs4all.nl.. . Hello,
Replacing the key : #0001# within $data doesn't work!! I want to replace it with a link!
Any sugestions?
Thanx, InSeCo
*Example of the problem :* <?php $data = "abcdefghijklmnopqrstuvwxyz #0001# abcdefghijklmnopqrstuvwxyz<BR> \n"; $data = $data."abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz<BR> \n"; $data = $data."abcdefghijklmnopqrstuvwxyz #0001# abcdefghijklmnopqrstuvwxyz<BR> \n";
$repldata = "<A href=link.html>link</a>"; $replold = "#0001#"; echo "<B>Original Data</B><BR>$data;<HR>"; echo "<B>Data to replace :</B> $replold <HR>"; echo "<B>Replace data with :</B> $repldata <HR>";
$data = str_replace($replold, $repldata , $data); // fix this echo "<B>New Data</B><BR>$data;<HR>";
?>
It doesn't perform the change on parameter given, instead it returns the
changed string. Surely, it must've done what you wanted using $data as
input, but your code just didn't assign the returned value to $data.
InSeCo wrote: str_replace($replold, $repldata , $data);
Perhaps it worked a bit better if you stored the result of str_replace()
somewhere?
Just wondering :)
--
Markku Uttula
How do I store the result somewhere else??
"Markku Uttula" <ma***********@disconova.com> wrote in message
news:Vs****************@reader1.news.jippii.net... InSeCo wrote: str_replace($replold, $repldata , $data);
Perhaps it worked a bit better if you stored the result of str_replace() somewhere?
Just wondering :)
-- Markku Uttula
InSeCo wrote: str_replace($replold, $repldata , $data);
Perhaps it worked a bit better if you stored the result of str_replace() somewhere?
How do I store the result somewhere else??
$data = str_replace($replold, $repldata , $data);
Please, read the manual. It has some great examples.
--
Markku Uttula This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jon |
last post by:
Why does the following not replace the ":)"?
str_replace(":)", " <img
src=http://www.com.com/forum/emoticons/smiley.gif> ", $_POST);
But, the following does replace the ":("?
...
|
by: Hugo Coolens |
last post by:
I need to use the str_replace function for a php-script which works
together with html/javascript.
In the script I have to perform things like:
$arabic=str_replace ("'","\'", $row);...
|
by: marcomputers |
last post by:
Hi,
I'm trying to automatically update an existing rss podcast file using
php and the str_replace function.
Every time I add a media file, it should read the .rss file into a
string, take the...
|
by: Wayne |
last post by:
$a = $_POST; # txt_content = This is a<CR><LF>Test
$p = str_replace ("%0D%0A", "<br>", $a);
That is the above code that I am using, however, it is not picking up
the CR/LF from the textarea. I...
|
by: The Numerator |
last post by:
I have this page (print.php). In that file, I want to to include a text
file from "songs/breathe.txt", and replace all instances of "<b" with
"<span" and "</b>" with "</span>". I know how I should...
|
by: d1srupt3r |
last post by:
I am developing my form into a captcha secured form and I used header() function if the user didn't put the verification code properly and still when the user go back to the form page the filled he...
|
by: jmark |
last post by:
I saw this example in php.net
// Outputs: apearpearle pear
$letters = array('a', 'p');
$fruit = array('apple', 'pear');
$text = 'a p';
$output = str_replace($letters, $fruit, $text);...
|
by: Confused but working on it |
last post by:
So I've been trying to get a bit of code to:
Read all of the files in a dir called thumbs, but not the . and .., use
the filename in a link to get the same filename in an images dir. Now
I'm...
|
by: Sean Kim |
last post by:
From example in the book 'Programming PHP' (O'Reilly) (p.305)
$theKey = 'DESTINATION';
$target = '{' . $theKey . '}';
$inValues = 'some.php';
//$theTemplate = str_replace("\{$theKey}",...
|
by: jodleren |
last post by:
Hi all
I have text area, where I can edit files - but I have to correct the
returned data, for that I use
$content=str_replace('\"', '"', $content);
and
$content=str_replace('\\', '\',...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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,...
|
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...
| |