Skip to content

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

Form validation rules for regex_match

I’m trying to figure out what I’m doing wrong with this validation rule because its saying this error. Validation rule: Error: Severity: Warning Message: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash Answer First, you need to fix your pattern. Your pattern rig…

Add six months in php

I’m trying to get the month, six months out from the current date. I’ve tried using: date(‘d’, strtotime(‘+6 month’, time())); But it doesn’t seem to work, always returns 01. Is there a better way to do this? Thank you! Answer I find working with DateTime much easier …

How to use preg_match to match numbers between hyphens?

I need to validate strings like this: I need the penultimate number between hyphens, so in this case ’10’. These are other examples: Can you help me? Answer this RegExp should do the trick using a positive lookahead: (change 4 to whatever max num of digits you want to allow)