Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
str_replace function giving fatal error
Old 02-07-2011, 08:59 AM str_replace function giving fatal error
Experienced Talker

Posts: 36
Trades: 0
I have a php file that processes a csv file downloading images and replaces a url in it. I am trying to add some code to replace SUV with 123 at the first instance in each row. I have this:

for($i=1;$i<$datalen;$i++)

{

echo str_replace('SUV','123',$i,'1');

...and I'm getting this error:
Fatal error: Only variables can be passed by reference in ... on line 38

All I did to the original functional code was add the line: echo str_replace('SUV','123',$i,'1');

Any help is appreciated.
nlassiter is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-07-2011, 12:04 PM Re: str_replace function giving fatal error
Average Talker

Posts: 25
Name: Reuven Gloriss
Location: NYC
Trades: 0
I don't understand, why you are putting the variable $i? its an integer.
you have to put the String variable you want to replace the text.
some thing like echo str_replace('SUV','123',$data[$i]);
post some more code for help
__________________
A Computer is like your body, protect it, use it smartly, add new features - and it will perform better.

Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
ruven is offline
Reply With Quote
View Public Profile Visit ruven's homepage!
 
Reply     « Reply to str_replace function giving fatal error
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27197 seconds with 12 queries