Skip to content

Tag: php

Is There A Way To glob() Only Files?

I know that glob can look for all files or only all directories inside a folder : But I didn’t found something to find only files in a single line efficiently. Works well but reads directory twice (even if there are some optimizations that make the second browsing quicker). Answer I finally found a solu…

PDO fetch / fetchAll

Not new to PHP, but only a day old to PDO. Surely I am doing something wrong here. the only way I can declare those $_SESSIONS properly is if I use $result[0][‘fieldName’]; How can I just access it via $result[‘fieldName’]; ? Answer fetchAll, as the documentation says, retrieves an arr…

Heroku: PHP Fatal error for valid function – mb_check_encoding

I have the following statement: This works on my local setup of PHP 5.4.17 and my shared host which has PHP 5.3.xx But when I deploy this app to Heroku (which has PHP 5.3.10), it gives the following error in the logs: 2012-12-26T09:55:28+00:00 app[web.1]: [Wed Dec 26 09:55:27 2012] [error] [client 10.119.79.7…

Crop local image file

I got a form that allow user to upload image and crop it I already figured out the flow of it 1.User upload the image 2.Server process it and send back to the browser 3.User crop it and send to the server 4.Server process and save it Is there any other way to achieve this? Perhaps using javascript to load