Search the Community
Showing results for tags 'str_replace'.
-
Can someone please tell me why neither one of these are working: $content = str_replace(array("\r", "\n"), '', $row['content']); $content = preg_replace( "/\r|\n/", '', $row['content']); I've tried each one of the to replace $content = $row['content']; and for some ungodly reason neither one of them are working. This is simply pulling content from a database but it keeps displaying \r\n when displayed in a page. Why?
-
I'm having a probably server-side issue that I cannot fix, so I need to find a workaround. I have a page designed to allow people to enter their report and email it to a list of people (it will vary each time). There are 2 ways people can enter an email recipient: full email address or first and last name (which is how you find people in the corporate Outlook Exchange accounts). So when the recipient field is entered, it may contain a mix of full email addresses or just first and last names (separated by commas). For example, here's my original array of email recipients: $recipient = "[email protected], John Smith, Barb Johnson"; The problem is with the first and last names. When the email sends, it adds the entire domain of the server to the email address. For example, if the server I'm using is "test.server.xyz.com" and I enter "John Smith", when the email gets sent, it sends to "[email protected]" instead of just "[email protected]". So I'm wondering if there's code that would search an array using mixed email addresses, locate just the ones with first and last names, and fix them. How would I code this so it ended up as: $new_recipients = "[email protected], [email protected], [email protected]"; Thanks in advance! Note: I've asked IT if they can fix something on the server end to correct this, but I'm not counting on their help, so looking for a workaround.