Skip to content

PHP DateTime round up to nearest 10 minutes

I’m retrieving a datetime from a mysql field but I need to round it up to the nearest 10 minutes. For example, If the datetime is 2013-11-06 14:00:01, I’d like to return the time as 6/11/2013 14:10. What’s the easiest way to do this? Any advice appreciated. Thanks. Answer 1) Set number of se…

Json_encode or remove last comma?

I figured out how to get my desired result (almost). My code adds a comma at the end before the last ] so it wont quite work. I know I can use Json_encode to build my array from my external json but I’m stumped. I either need to remove the last comma or use json_encode (which i’m lost on) any

Executing Python Script with PHP Variables

I am writing a simple application that uses information from a form, passes it through $_POST to a PHP script that executes a python script and outputs the results. The problem I am having is that my python script is not actually running with the arguments being passed in. process3.php file: Output: At the to…

dompdf HTML to PDF – can’t set margin of page

version: 0.6.0 beta 3 I tryed in every manner to make dompdf set the margin of the page. I have a long page with a lot of text, divided in chapters… my css is something like: when the php is but what I get is a page with NO margins!!! only the padding of the #wrapper are applied… and they

sprintf argument swapping and HEREDOC

I’m trying to use sprintf on a heredoc this way. It wont work. Any idea how to solve this? $i = <<<EOD This is your invoice for %1$s %1$s %1$s %1$s EOD; $year = '2013'; $i = sprintf($i,$…