I have no experience when dealing with large files so I am not sure what to do about this. I have attempted to read several large files using file_get_contents ; the task is to clean and munge them using preg_replace(). My code runs fine on small files ; however, the large files (40 MB) trigger an Memory exha…
Tag: php
PHP strtotime() different results of monday this week
I have a problem getting the date of monday in the current week. When I’m running the above code on my local machine (PHP 5.3) it outputs correctly ‘2011-03-07’, but the same code on my server (PHP 5.2) outputs ‘2011-03-14’ (that’s monday next week). I’ve tried to run…
PHP Namespace 5.3 and WordPress Widget
I am using namespaces. I try to create a WordPress widget (http://codex.wordpress.org/Widgets_API) With namespaces the following gives an error because the arguments can not be passed (and without …
should i still sanitise input with mysqli?
I’m using mysqli prepared statements. Should I still sanitise the user input with some function like: Thanks. Answer No! No and no. If you are already using prepared statements, MySQL needs to see the value, not some escaped version of it. If you add mysql_real_escape_string to a string and make that th…
Stacking Multiple Ternary Operators in PHP
This is what I wrote : $Myprovince = ( ($province == 6) ? “city-1” : ($province == 7) ? “city-2” : ($province == 8) ? “city-3” : ($province == 30) ? “city-4” : “out of borders” ); But for every …
append query string to any form of URL
I ask user to input a URL in a text-box and need to append a query string to it. Possible values of URLs can be like: http://www.example.com http://www.example.com/a/ http://www.example.com/a/?q1=one http://www.example.com/a.html http://www.example.com/a.html?q1=one Now I need to add query string to it like &…
Why MySQLi prepared statements?
What are the advantages of using prepared statements with MySQLi? If the only purpose is to secure the query, isn’t it better to clean the query using something like mysqli_real_escape_string instead of writing so many lines of code for each query (like prepare, bind_param, execute, close, etc.)? Answer…
Maintenance mode strategy with SEO in mind [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about programming within the scope defined in the help center. Closed 10 days ago. Improve this question What are considered the best practices when putting your site in ma…
PHP MySql display returned content without html tags being stripped
I have a column in SQL ‘Text’ datatype and inside I have content within html tag, eg somecontent: onetwo… I want the mysql query to echo out the databases contents without stripping the html tags (its possible this is done by php for security reasons or?) so that the html code will render if…
PHP installation on windows
I want to install php in my system.For this I have downloaded the php-5.3.5.tar.bz2 (zip file). Now from this installation help link http://www.php.net/manual/en/install.windows.installer.msi.php It is saying “Run the MSI installer and follow the instructions provided by the installation wizard. ”…