Fatal Error Call To Undefined Function Str_replace
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Issue replacing content with str_replace up vote 1 down vote favorite I'm working with a CMS spanish website, and I'm trying to replace the months to spanish. This is how it looks like with the date function date("F j, Y, g:i a"): August 24, 2011, 1:47 pm Now I want it to look like this: Agosto 24, 2011, 1:47 pm Using an example from the Php Documentation I made this: $p['time'] = date("F j, Y, g:i a"); $time_english = $p['time']; $search = $time_english('August', 'September', 'October', 'November', 'December'); $replace = $times_spanish('Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'); $subject ='August'; str_replace($search, $replace, $subject); The following error appears: Fatal error: Call to undefined function August 24, 2011, 3:50 pm() in $search = $time_english('August', 'September', 'October', 'November', 'December'); php str-replace share|improve this question asked Aug 24 '11 at 21:52 Gabriel Meono 34011138 You are calling $time_english and $time_spanish as functions, it should be array(). –Usman Aug 24 '11 at 22:02 add a comment| 3 Answers 3 active oldest votes up vote 2 down vote It would be far easier to just use strftime(). All you have to do is set a locale and you can output in your desired language. Example: setlocale(LC_ALL, 'es_ES'); // I think it´s es_ES $my_time = strftime("%B %e, %G, %I:%M %P"); // something like that... share|improve this answer edited Aug 24 '11 at 22:14 answered Aug 24 '11 at 21:56 jeroen 68.9k1374110 Can you give a concrete example? –Gabriel Meono Aug 24 '11 at 21:58 @Gabriel I have added an example. –jeroen Aug 24 '11 at 22:02 I'm placing setlocale(LC_TIME, "es_ES"); before the date functions and it's not working –Gabriel Meono Aug 24 '11 at 22:03 @Gabriel I think it depends on the instal
for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Ask a Question Ask for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Expand Search Submit Close Search Login Join Today Products BackProducts Gigs Live Careers Vendor Services Groups Website Testing Store Headlines Experts Exchange > Questions > Call to undefined function using str_replace() Want to Advertise Here? Solved Call to undefined function http://stackoverflow.com/questions/7182778/issue-replacing-content-with-str-replace using str_replace() Posted on 2005-05-29 PHP 2 Verified Solutions 6 Comments 1,399 Views Last Modified: 2013-12-12 Running PHP 4.3.11 in UNIX I have used str_replace() many times, however, this particular instance or environment is causing me problems. I have an array, let us call it $array I would like to replace instances of one character https://www.experts-exchange.com/questions/21440734/Call-to-undefined-function-using-str-replace.html with another lets say replace "Q" with " | ", that is replace instances of the letter "Q" with the " | " pipe. My call is: $array = str_replace("Q", " | ", $array); The result is: Call to undefined function str_replace() I had believed str_replace was a pre-defined function and other pre-defined functions perform as expected. Thoughts ? Many thanks. 0 Question by:ethanfox Facebook Twitter LinkedIn Google LVL 1 Best Solution bymajorspank Very strange, because that function is built into PHP, when you run the following if (function_exists("str_replace")) { echo "str_replace found"; } else { echo "no dice"; } You can also Go to Solution 5 Comments LVL 29 Overall: Level 29 PHP 19 Message Active 1 day ago Expert Comment by:fibo2005-05-30 I don't think that "str_replace" can work directly on an array. You should use the function array_walk_recursive with str_replace (see http://www.php.net/manual/function.array-walk-recursive.php ) That would be function My_str_replace ( &$tmp) { $tmp1= str_replace("Q", " | ", &$tmp); return $tmp1; } .... array_walk_recur
your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the http://board.phpbuilder.com/showthread.php?10224917-Help-Fatal-error-htmlspecialchars() register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 9 of 9 Thread: Help: Fatal error: https://groups.google.com/d/topic/google-maps-api/qiPg2rSH3YI htmlspecialchars()???? Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode fatal error 01-16-2003,05:01 AM #1 CoderJohan View Profile View Forum Posts Member Join Date Jan 2003 Posts 48 Help: Fatal error: htmlspecialchars()???? I read on www.php.net... the php manual on how to use htmlspecialchars() i'm trying to eliminate some security issus so ppl can't send javascript or anyother script to the guestbook but i have run into a problem that i do not fatal error call know how to solve... Maby anyone of you can? As you can see below it's the error msg and below that is the code i'm using... I'm using the latest php version so it should not be any problem... Help please //Johan Fatal error: Call to undefined function: _htmlspecialchars() in /home/syskonskapet/public_html/fspalt/spara.php on line 12 $text_=_htmlspecialchars($text); $text = str_replace('>', '>', $text); $text = str_replace(' von GoogleAnmeldenAusgeblendete FelderNach Gruppen oder Nachrichten suchen
', '
', $text); $text = str_replace('', '', $text); $text = str_replace('', '', $text); $text = str_replace('', '', $text); $text = str_replace('', '', $text); Reply With Quote 01-16-2003,05:17 AM #2 sijis View Profile View Forum Posts Senior Member Join Date Oct 2002 Location USA Posts 374 change the first line of code to look like this: $text = htmlspecialchars($text); Reply With Quote 01-16-2003,05:19 AM #3 milind24 View Profile View Forum Posts Visit Homepage PHPMySQLWizard Join Date Jul 2002 Location India [Mumbai] Posts 97 Try this it will work: just remove underscore from function _htmlspecialchars PHP Code:
$text=htmlspecialchars($text);
$text=