Skip to content

PHP Difference between array() and []

I’m writing a PHP app and I want to make sure it will work with no errors. The original code: Would the following work with no errors or is not recommended for some reason? Are there any difference? I’ve looked again the data about array() and the short array method with square brackets [] in PHP.…

PHP – imagecreatefromjpeg uses 100M memory for <1M image

The image is less than 1MB but the size is roughly 5500×3600. I am trying to resize the image down too something less than 500×500. My code is pretty simple. I found out that to process this image, the imagecreatefromjpeg uses 100M using memory_get_usage. Is there a better way to do imagecreatefromj…

Sending free sms using PHP

I am trying to develop a PHP based application to send sms across India to contacts picked from the database. After searching for hours, I found the following working (I tested it) script which makes …

Removing successive duplicate occurrences in an array

Is there any way that I can remove the successive duplicates from the array below while only keeping the first one? The array is shown below: What I want is to have an array that contains: Answer You can just do something like: Assuming you’re not manipulating that array in between you can use current()…

How to Load Ajax in WordPress

I’m familiar with using ajax in the ordinary way with jQuery. I’ve played around it for a while, but don’t understand what WordPress needs to get it to work… What I have here is taken from some …