{"id":6406,"date":"2014-04-17T02:01:10","date_gmt":"2014-04-17T02:01:10","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/17\/phptemplatesstr-replacerelated-issues-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:47:13","modified_gmt":"2022-08-30T15:47:13","slug":"phptemplatesstr-replacerelated-issues-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/17\/phptemplatesstr-replacerelated-issues-collection-of-common-programming-errors\/","title":{"rendered":"php,templates,str-replaceRelated issues-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/7xvUe.jpg?s=32&amp;g=1\" \/><br \/>\nIain<br \/>\napache-2.2 php centos suphp<br \/>\nWe have a server that&#8217;s handling uploads. The memory limit is set at a ridiculously high level in php.ini (800 M).. however we have gd, which is managing the image resizing, but it is dying at about 60M of memory usage (our error log is reporting a fatal error at this stage).From all our Apache config files (CPanel\/WHM managed), I can&#8217;t find a RLimitMem that&#8217;s set anywhere either.I&#8217;ve looked as well if there&#8217;s any limits set in our kernel, but can&#8217;t find anything there as well.Is there somethin<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/563c72fef22f25de58e45db2b8c3a678?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nHaresh Vidja<br \/>\nubuntu php wordpress<br \/>\nI have moved my server data PHP + WordPress and database(mysql) from one server to another server&#8230; All things working fine&#8230; but some time i got page blank in click submit button.. This problem occures some time ..I didnt get any error or fatal error in errorLog file and not get access entry in accsessLog file also on time of blank page.. Black page issue occurs some time on same taskSo how can I fix this problem..<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/481707331ea4d07ae2490bb88ddfd7ca?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nScott Pack<br \/>\napache-2.2 php centos<br \/>\nSo the same code works on my Ubuntu server but when I upload it to my dedicated hosting server running CentOS it seems to add an extra prefix of .:\/usr\/share\/pear:\/usr\/share\/php: I tried setting includepath to different things but it just doesn&#8217;t work. The file is in a directory called language in the same folder as the file that is including it and I&#8217;m using:include dirname(__FILE__).DIRECTORY_SEPARATOR.&#8221;language&#8221;.DIRECTORY_SEPARATOR.&#8221;storage.inc&#8221;; include dirname(__FILE__).&#8221;\/language\/language.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/3867e5562a0c8382d6149f916b524d48?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nmike<br \/>\nphp cpanel pdo<br \/>\nGetting this error: Fatal error: Class &#8216;PDO&#8217; not foundHave these lines in php.ini:extension=pdo.so extension=pdo_sqlite.so extension=sqlite.so extension=pdo_mysql.soThis shows up in php.info()&#8211; &#8211;enable-pdo=shared&#8217; &#8216;Have access to whm but there is no &#8220;software&#8221; tab from which to access easyapatche? Any suggestions??<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/efa357df02849a87e77de7377bfcd730?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMahbubur R Aaman<br \/>\nphp centos zend-framework<br \/>\nShows PHP Fatal Errormain(): Failed opening required &#8216;Zend\/Loader.php&#8217;I have installed ZF on \/usr\/share\/phpzf command is working. I can create project and do other works using zf command. But while including the library path then shows the error.Am i missing something?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/dcfb3f966fc5d6ef1f37aa0e14e7ae1f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPassionate Developer<br \/>\napache-2.2 php<br \/>\nI am getting below errors despite setting memory_limit in php.ini to 64mb:Fatal error: Out of memory (allocated 6291456) (tried to allocate 91284 bytes) in \/home\/favstayc\/public_html\/coverbuddy2\/cake\/libs\/configure.php on line 1067What could I change to fix this issue?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/949e93aea69788cc3e8ce672a83da762?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBlaM<br \/>\nphp iis7 stdout stderr<br \/>\nOkay, this is slowly getting annoying. I&#8217;m used to work with Apache Webservers and never had any of these problems. IIS seems to try to be intelligent &#8211; or whatever.Here&#8217;s my situation: My customer wants a PHP website and it is supposed to run on an Windows IIS webserver.For my development environment I could use my Apache &#8211; but just to be sure I want to do it with IIS, too. So I set up a dev-server with Windows Vista, all the latest Updates and installed IIS. Everything fine!I quickly found ins<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/190363ec30ddc9f3a9dde0888bfe224e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nWerkkreW<br \/>\napache-2.2 php varnish<br \/>\nWe recently migrated our site to a load balanced apache cluster behind varnish. Since that time a very small subset of users is reporting they cannot view any pages. I have narrowed the issue down quite a bit. This issue was not present before the move, the old infrastructure was a single large box.We are on Rackspace Cloud running 8 apache2 instances behind varnish 3.0 all load balanced using Rackspace Cloud load balancers (Zeus) and 2 mysql instances for a total of 10 servers, all linux.Use<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/LbXVy.jpg?s=32&amp;g=1\" \/><br \/>\nUvais Ibrahim<br \/>\nphp php-extensions pecl expect<br \/>\nI got some serious error while installing expect extension in PHP.I ran sudo pecl install channel:\/\/pecl.php.net\/expect-0.3.1I got error like this while running make,running: make \/bin\/bash \/tmp\/pear\/temp\/pear-build-rootvXp7LZ\/expect-0.3.1\/libtool &#8211;mode=compile cc -I. -I\/tmp\/pear\/temp\/expect -DPHP_ATOM_INC -I\/tmp\/pear\/temp\/pear-build-rootvXp7LZ\/expect-0.3.1\/include -I\/tmp\/pear\/temp\/pear-build-rootvXp7LZ\/expect-0.3.1\/main -I\/tmp\/pear\/temp\/expect -I\/usr\/include\/php5 -I\/usr\/include\/php5\/main -I\/u<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/9fc5a15f52c68f1cbcf6c1d47fdca21c?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJustin808<br \/>\nphp http httpd hostgator<br \/>\nOK, so I&#8217;m uploading a 350meg zip file. The file one uploaded is unzipped and the contents are processed. The processing consists of reading in a data file, then copying and thumbnailing images, the adding data to a database. This is all once process start to finish. I can see in the log that the datafile is processed. I can see on the filesystem the thumbnails get created. But then it looks like the whole this starts over from scratch with blank post data and it fails.When I look at the httpd l<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/c22fb0c0274425088e8580cc92137607?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nLodder<br \/>\ntemplates joomla error-handling joomla3.1<br \/>\nI&#8217;m struggling to improve my Joomla website. I&#8217;m getting a 500 error when I try to open my articles in the front end, so I changed the error reporting to &#8220;Developed&#8221;. I then received the following error:Fatal error: Class &#8216;Jhtml&#8217; not found in \/xxx\/components\/com_comment\/templates\/default\/default.php on line 49How to I prevent this error from occuring? Could someone also point out a good free template website if the problem lays in me changing the template?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/4810c6c963334e5dce573e6671d746ec?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ntimrau<br \/>\nc++ templates overloading friend unions<br \/>\nWhile working on my basic vector library, I&#8217;ve been trying to use a nice syntax for swizzle-based printing. The problem occurs when attempting to print a swizzle of a different dimension than the vector in question. In GCC 4.0, I originally had the friend &lt;&lt; overloaded functions (with a body, even though it duplicated code) for every dimension in each vector, which caused the code to work, even if the non-native dimension code never actually was called. This failed in GCC 4.2. I recently r<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/672ac8293a1e7c65c7909056c1f0348a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nVincent<br \/>\nc++ templates types casting<br \/>\nI&#8217;m implementing some classes for linear algebra operations on very small constant size vector and matrices. Currenty, when I do :MyMathVector&lt;int, 3&gt; a ={1, 2, 3}; MyMathVector&lt;double, 3&gt; b ={1.3, 2.3, 3.3}; std::cout&lt;&lt;&#8220;First = &#8220;&lt;&lt;a+b&lt;&lt;std::endl; std::cout&lt;&lt;&#8220;Second = &#8220;&lt;&lt;b+a&lt;&lt;std::endl;Then First = {2, 4, 6} and Second = {2.3, 4.3, 6.3}, because the second element is casted to the first element type by the compiler. Is there any &#8220;easy&#8221; way to provi<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/LXJ8Y.jpg?s=32&amp;g=1\" \/><br \/>\nDark_Daiver<br \/>\nc++ templates<br \/>\nI have a simple hash table template, template &lt;class K, class V, long H(K)&gt; class HashTableAbs{\/* &#8230;. *\/} \/\/where K is key type, V is value type, H gives hash code for K valueand simple inheritor classtemplate &lt;class K, class V, long H(K)&gt; class HashTable:public HashTableAbs&lt;K, V, H&gt; {}; and i want to specialize this template for string, with my default hash functiontemplate &lt;class V&gt; class HashTable&lt;std::string, V, strSimpleHash&gt;:public HashTableAbs&lt;std::strin<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0f33775eaa7e8ee316eaa44550efdfa4?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBrandon Pelfrey<br \/>\nc++ linux ide templates<br \/>\nI have a friend who is trying to make the switch to Linux, but is hung up on the apparent lack of debugging\/IDE environments for C++, especially as they relate to template programming. He has been using visual studio for years and is maybe a little spoiled by their awesome IDE. Does anyone have any good suggestions for an environment where he can, under Linux, develop and debug with all of the usual things (Breakpoints, line highlighting for compilation errors, step in\/over\/out\/etc, etc) that he<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/1a3bf0f9c8b5a4c4eeea57eccb5eb164?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMadScienceDreams<br \/>\nc++ templates c++11 variadic-templates<br \/>\nSo someone asked a question then deleted it, but I found it an interesting challenge.They had this weird type, and had run into the problem that Concat and Range were castable to Sequences but were not Sequences (for obvious reasons)template&lt;unsigned&#8230; Is&gt; struct Sequence{}; template&lt;typename&#8230; Is&gt; struct Concat{}; template&lt;unsigned&#8230; Is&gt; struct Concat&lt;Sequence&lt;Is&#8230;&gt;&gt; : public Sequence&lt;Is&#8230;&gt; {}; template&lt;unsigned&#8230; Is, unsigned&#8230; Js, typename&#8230; R<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/9314022feaa6eede0a5430f3323a9cfe?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAncurio<br \/>\nc++ templates pointers reference virtual<br \/>\nConsider following code:template&lt;typename T&gt; struct MyTempl {virtual void doStuff(const T &amp;value) = 0; };struct MyImpl : MyTempl&lt;int&gt; {void doStuff(const int &amp;value) {} };struct MyPtrImpl : MyTempl&lt;int*&gt; {void doStuff(const int* &amp;value) {} };MyImpl imp1; MyPtrImpl imp2;This will not compile correctly: the compiler tells me that doStuff() in MyPtrImpl is pure virtual, ie. I failed to correctly override it. If I however typedef int* to something like int_ptr, and use<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0d30dfb4a79fbeb45242979f90aa4cd5?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nSoapBox<br \/>\nc++ templates<br \/>\nI have a template class with an overloaded + operator. This is working fine when I am adding two ints or two doubles. How do I get it to add and int and a double and return the double?template &lt;class T&gt; class TemplateTest { private:T x;public:TemplateTest&lt;T&gt; operator+(const TemplateTest&lt;T&gt;&amp; t1)const{return TemplateTest&lt;T&gt;(x + t1.x);} }in my main function i havevoid main() {TemplateTest intTt1 = TemplateTest&lt;int&gt;(2);TemplateTest intTt2 = TemplateTest&lt;int&gt;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/84a6aa25ee85e948123d97b672135526?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nsbi<br \/>\nc++ templates programming-languages semantics<br \/>\nI am looking at some c++ code and do not understand the purpose of the template declaration in this situation:template&lt;&gt; void operator&gt;&gt;(const ClassA&amp; s, const ClassB d) {&#8230;}What is the semantic of template&lt;&gt;?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/48d023c0970ff0ed66f9c08930a95b16?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMihai Stancu<br \/>\nphp mysql database templates phpmyadmin<br \/>\nhttp:\/\/dl.dropbox.com\/u\/11246427\/naysof_template.rarI am using XAMPP and set up my db using phpmyadmin.above is my current project. I am trying to set up a database to this &#8220;quote&#8221; template. As you may see, most of the user&#8217;s input are the &lt;textarea&gt;.I want the invoice number to be auto-increment, and when save is clicked(i made a button on other template already), it will store the data into the database. I created database, tables but i am not sure how to set this up.Do I include all tex<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f26727beba01cfc9c65e469d5ef94abf?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser1860536<br \/>\nphp function preg-replace str-replace<br \/>\nI try change characters by functions&lt;?php $string = &#8220;Hi everybody people [gal~images\/articles~100~100~4] here other imagen [gal~images\/products~100~100~3]&#8221;;$regex = &#8220;\/\\[(.*?)\\]\/&#8221;; preg_match_all($regex, $string, $matches);for($i=0; $i&lt;count($matches[1]);$i++) { $match = $matches[1][$i]; $array = explode(&#8216;~&#8217;, $match);\/\/$newValuet=&#8221;gal(&#8220;&#8221;.$array[1].&#8221;&#8221;,&#8221;&#8221;.$array[2].&#8221;&#8221;,&#8221;&#8221;.$array[3].&#8221;&#8221;,&#8221;&#8221;.$array[4].&#8221;&#8221;)&#8221;;$newValue=&#8221;gal(&#8220;.$array[1].&#8221;,&#8221;.$array[2].&#8221;,&#8221;.$array[3].&#8221;,&#8221;.$array[4].&#8221;)&#8221;;$string = str_repl<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/906316e01d72889e4c6a9d1d92c77f46?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nClay Smith<br \/>\nphp str-replace<br \/>\nI am getting an error on the str_replace line. I am trying to replace the $_SESSION variable with the constant of it. What am i missing?$resume = fopen(&#8216;creative\/&#8217;.$_SESSION[&#8216;user&#8217;].&#8217;\/resume.php&#8217;, &#8216;r&#8217;) or die(&#8216;error when opening the file&#8217;); $fp = fopen(&#8216;creative\/&#8217;.$_SESSION[&#8216;user&#8217;].&#8217;\/resume2.php&#8217;, &#8216;w&#8217;); $creative = $_SESSION[&#8216;creative&#8217;]; $user = $_SESSION[&#8216;user&#8217;]; if ($resume){ while (($buffer = fgets($resume, 4096)) !== false) {str_replace(&#8220;\\$_SESSION[creative]&#8221;, $creative, $buffer);str_replace<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/9dd7a935dbeec0b548ca31b326133245?s=32&amp;d=identicon&amp;r=PG&amp;f=1\" \/><br \/>\nuser3185672<br \/>\njavascript php xmlhttprequest youtube-api str-replace<br \/>\nI have this PHP code, which try to get the description of a YouTube channel, and run it in a JS file (xhr_object), and I&#8217;ve got this error : Unexpected token ILLEGAL. But I found the problem : $channel_descr contains a simple quote in somes cases, which break the JS code. I&#8217;ve already tried to use str_replace() but it doesn&#8217;t change anything..$json = file_get_contents(&#8220;&#8230;?alt=json&amp;part=snippet&#8221;); $data = json_decode($json, true);$channel_descr = $data[&#8216;entry&#8217;][&#8216;content&#8217;][&#8216;$t&#8217;]; $channel_des<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/d4f658f89a7df51ffee179ebf4657328?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nsparkle<br \/>\nphp str-replace<br \/>\nString (JSON): {&#8220;title&#8221;:&#8221;\\&#8221;Copper\\&#8221;&#8221;}I have tried$output = str_replace(&#8216;\\\\&#8221;&#8216;, &#8220;&#8221;, $output);but I got{&#8220;title&#8221;:&#8221;&#8221; Copper&#8221;&#8221;}What I expect{&#8220;title&#8221;:&#8221;Copper&#8221;}<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b655006566208390a086dff5158a5d9c?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDevatoTech<br \/>\nphp str-replace<br \/>\n$embedCode = &lt;&lt;&lt;EOF getApplicationContent(&#8216;video&#8217;,&#8217;player&#8217;,array(&#8216;id&#8217; =&gt; $iFileId, &#8216;user&#8217; =&gt; $this-&gt;iViewer, &#8216;password&#8217; =&gt; clear_xss($_COOKIE[&#8216;memberPassword&#8217;])),true) EOF; $name = str_replace($embedCode,&#8221;test&#8221;,$content);I&#8217;m trying to replace a section of code with another piece of code. I can do it with smaller strings but once I added the larger strings to $embedCode, it throw an &#8220;unexpected T_ENCAPSED_AND_WHITESPACE&#8221; error<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a8defe14b1c80bc2bd59a1fab3848cfb?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nbinki<br \/>\nphp arrays str-replace<br \/>\nphp &gt; echo str_replace(array(&#8216;0&#8217;, &#8216;1&#8217;, &#8216;2&#8217;, &#8216;3&#8217;, &#8216;4&#8217;, &#8216;5&#8217;, &#8216;6&#8217;, &#8216;7&#8217;, &#8216;8&#8217;, &#8216;9&#8217;, &#8216;a&#8217;, &#8216;b&#8217;, &#8216;c&#8217;, &#8216;d&#8217;, &#8216;e&#8217;, &#8216;f&#8217;),array(&#8216;a&#8217;, &#8216;b&#8217;, &#8216;c&#8217;, &#8216;d&#8217;, &#8216;e&#8217;, &#8216;f&#8217;, &#8216;g&#8217;, &#8216;h&#8217;, &#8216;i&#8217;, &#8216;j&#8217;, &#8216;k&#8217;, &#8216;l&#8217;, &#8216;m&#8217;, &#8216;n&#8217;, &#8216;o&#8217;, &#8216;p&#8217;),&#8217;01234567890abcdef&#8217;) . PHP_EOL; klmnopghijkklmnopI expected this str_replace() call to give me something like abcdefghijklmnop. But it seems that the numeric strings in my search array are being treated as something other than strings.I am ultimately just going for the functionality of tr(1) (e.g., tr<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/adb0cdf5e7d7bb2bb566b7acf005f2f4?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nIsaac Boda<br \/>\nphp str-replace<br \/>\n&lt;?php $date = date(&#8216;n\/j\/Y&#8217;); $lines = file(&#8216;..\/lines.txt&#8217;);foreach($lines as $line)$line = str_replace($date, &#8221;, $line);echo $line; ?&gt;Why will the above str_replace work for me, no matter how I re-arrange it I get this error:Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in File line 20 ($line = str_replace &#8230;.)<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/Jh3mC.jpg?s=32&amp;g=1\" \/><br \/>\nHamZa<br \/>\nphp str-replace<br \/>\nI have to alter two things in this example text:example_1,example_2I need to appear this way: example 1, example 2So I need to replace the &#8220;_&#8221; with a space &#8221; &#8221; as well as the &#8220;,&#8221; to &#8220;, &#8221; with a space. Currently I have this code below and it replaces the underscore fine, but I don&#8217;t know how to also integrate the &#8220;,&#8221; part in this code. str_replace(&#8216;_&#8217;, &#8216; &#8216;, $test)Would it be something like this:str_replace((&#8216;_&#8217;, &#8216; &#8216;,),(&#8216;,&#8217;, &#8216; &#8216;), $test)<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a3456d5199075a698c2247c079733eb3?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\njoelrnorris<br \/>\nphp syntax str-replace autoloader psr-0<br \/>\nI&#8217;m dabbling w\/ a &#8216;lightweight&#8217; PSR-0 AutoLoader for a WordPress Plugin, it runs fine on my local dev server, but when i push it up to one of WPEngine&#8217;s staging servers, i get this:Parse error: syntax error, unexpected &#8216;[&#8216;, expecting &#8216;)&#8217; in \/nas\/wp\/www\/staging\/ahsodesigns\/wp-content\/plugins\/AhSoFunctionality\/start.php on line 30here&#8217;s the AutoLoader, \/\/ lightweight psr-0 autoloader spl_autoload_register(function ($classname) {\/\/ make sure we&#8217;re only loading classes from our directory,if (preg_m<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6a17de90749f7777d0dbaeeaef51f076?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nFuxi<br \/>\nphp str-replace<br \/>\ni&#8217;m having the following php code:$html = &#8216;&lt;p&gt;[tag]&lt;\/p&gt;&#8217;;$test = &#8220;&lt;a href=&#8217;#&#8217;&gt;&lt;div class=&#8217;test&#8217;&gt;button&lt;\/div&gt;&lt;\/a&gt;&#8221;;$html = str_replace(&#8220;[tag]&#8221;, $test, $html);when using echo htmlentities($html) i&#8217;m getting the expected result:&lt;p&gt;&lt;a href=&#8217;#&#8217;&gt;&lt;div class=&#8217;test&#8217;&gt;button&lt;\/div&gt;&lt;\/a&gt;&lt;\/p&gt; but when echoing the $html, firefox renders it like this:&lt;p&gt; &lt;a href=&#8221;#&#8221;&gt;&lt;\/a&gt; &lt;\/p&gt; &lt;div class=&#8221;test&#8221;&gt; &lt;p&gt;&lt;\/p&amp;g<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Iain apache-2.2 php centos suphp We have a server that&#8217;s handling uploads. The memory limit is set at a ridiculously high level in php.ini (800 M).. however we have gd, which is managing the image resizing, but it is dying at about 60M of memory usage (our error log is reporting a fatal error at [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,1,8],"tags":[],"class_list":["post-6406","post","type-post","status-publish","format-standard","hentry","category-semantic","category-uncategorized","category-zend-framework"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6406","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6406"}],"version-history":[{"count":1,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6406\/revisions"}],"predecessor-version":[{"id":8775,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6406\/revisions\/8775"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6406"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6406"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}