Most of us have come across this error: “Fatal error: Allowed memory size of xxxxxx bytes exhausted (tried to allocate yyy bytes) in ….” in the php error logs.
In php, running out of memory in usually a sign that your php script is not too well written or has a bug or two in it; However sometimes even the best of our php scripts still require more memory than usual especially if it is handling large amounts of data.
Luckily in php, increasing the memory limit is an easy task to do and can be done in a number of ways.
People access your site aren’t always in the same timezone as you are. Now perhaps you would like to determine what the time is for a user in a different country. Then here is a quick way to find this information out.
This example is very useful if you simply want to fetch your clients date and time or timezone; but also good to see what time of day (their time, not server time) your clients access your website.
The way the below example works, is that the client will click a submit button which sets the value of the hidden input field to their local time stamp and that gets submitted to the same php script. Then the php script checks if that value has been sent and if it has, then it gets the local time (of the server) and takes the clients times and shows a message depicting the difference.
Below is a list of mime-types I come across most often. Suggest others that should be a part of the list by leaving a comment below. You can also view my article on finding the mime-type of a file by check out my article on PHP Function To Get File Mime Type.
PHP – text/html
HTML – text/html
HTM – text/html
CSS – text/css
This series of articles will focus on XML, its applications in modern day web development and how PHP fits into this niche. In this article, we will focus specifically on the tools provided to us by PHP which enable us to manipulate XML data sources.
What is XML and Why Use it?
XML (eXtensible Markup Language) is a W3C standard designed to allow the easy exchange, storage and use of data between web applications and services.
Again, we’ll use PHP’s strstr function to search for Android in the user agent:[php toolbar=”true” classname=”one_line”] $ua = strtolower($_SERVER[‘HTTP_USER_AGENT’]);