Skip to content

Tag: php

usort descending

When i try to apply the below code from here it gives me results in ascending order. Output: On swapping $a and $b it gives the results in descending order except one value Output: i want to have the results in the below order: How do i achieve the same.? Answer My first guess is that usort expects an integer

How to extract images from a PDF in their original format

I’m using pdfimages -j bar.pdf /tmp/image to extract images from a PDF. My objective is to get them in their raw state as they were added. So If it was a .tif I’d like to get a .tif, if it’s a jpg I’d like to get a .jpg. I keep getting .ppm for everything I extract. Is it possible to

Check if specific input file is empty

In my form I have 3 input fields for file upload: How can I check if cover_image is empty – no file is put for upload? Answer You can check by using the size field on the $_FILES array like so: (I also check error here because it may be 0 if something went wrong. I wouldn’t use name for

Calling console command within command and get the output in Symfony2

I have a few console command in Symfony2 and I need to execute one command from another command with some parameters. After successfull execution of the second command I need to get the result (as an array for example), not the display output. How can I do that? Answer Here you can have a basic command inside…

How can i secure this API in an APK file

I am currently developing an api for a website i run. The api will be used in a number of places, and one of those places is an Android app. It’s purpose is to allow users to login, and and download files. I have the api build, and it will be using HTTPS so all of the data is fine

php header location vs php_redirect

What’s the difference between the function “HTTP_redirect” and “header location” in PHP ? When must I use the function “HTTP_redirect” ? When must I use the function “header location” ? Look that: https://php.net/manual/en/function.http-redirect.php &#8211…