Jump to content

[SOLVED] Alright, str_replace is being a b****!


Recommended Posts

This guy is pretty much a turd, for someone asking for help. I say he take his infinite knowledge and figure it out.

 

For someone with that attitude, sure took him a while to notice he was only copying the original variable...and not redefining it's value.

<?php
if (isset($dat) && is_array($dat)) {
   foreach ($dat as $key => $val) {
       $dat[$key] = str_replace(" ", "-", $val);
   }

   $data = $dat['title'];
   echo "<pre>", print_r($dat), "</pre><br />";
   echo "Data (of title) contains: " . $data . "<br />";
}else {
    echo 'Oh No! We do not have an array or a set variable!!!!!';
}
?>

 

See what that gets you.

 

 

Edit:

 

After reading the above posts by the topic starter I debated actually removing this code, learn some respect and manners man. If I was a mod, you would have been kicked off the site for dis-respectful comments like that.

 

Seriously, people are only trying to help and help open up some insight to you. You know 100% of the job is on you, if I solve this problem for you I do not gain any profit or incentive of anytype. If you cannot do it than its not our problem, thats your problem. I suggest you take on a new attitude.

I don't think it merits a ban, but he should be aware that such an attitiude will deter people from answering future posts. I have a list of such people and just ignore their questions - it's not worth the aggro - especially those that PM me with "Why don't you answer my question?". Like it's compulsory!

Please provide me with an example?

 

Comments like these....

 

That's not your business, when I tell you what the values contain.

Nice, I think you at least know what you're doing.

Your code is useless, didn't even try it!

 

Will get you knowhere fast.

 

 

Okay so none of the code snippets supplied is not working? If that's the case can you please post your full code here so we can see how you are using the suggested code snippets.

 

Also can everyone quit the insults too. If you are not going to contribute to this thread then don't post at all.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.