Use a foreach with multiplication between numbers with 8 houses after the comma + 100 hours

2

I'm trying to mount a foreach or something similar so that the following happens:

I have a value where it is a fraction of 1 , in this case it would be 0.00000100 ie eight houses after the period. Also I have a date, for example yesterday's date 23/04/2015 12:30:12 .

What I would like to do is to multiply the fraction (ex: 0.00000150 * 3 = 0.00000450) and on the date add 100 hours.

An example of how it would look, with the base value being 0.00000100 - dia 23/04/2015 14:38:45 , where it will be multiplied by 3, something like:

$multiplicado = 3;
$string = '0.00000100 - dia 24/04/2015 12:24:45';

Where the result would be a list something like this:

0.00000200 - dia 28/04/2015 16:24:45
0.00000300 - dia 02/05/2015 20:24:48
0.00000400 - dia 07/05/2015 00:25:14

It would be a list more or less like this, where it takes the value and multiplies the fraction by it and adds 100 hours. Is to get what I have today 0.00000100 and show what I will have 100 hours, 200 hours and 300 hours. Of course I put it multiplied by 3 , but it can be more or it can be less.

I do not know if a foreach would be ideal, but I think so ... I just can not do that.

If anyone has any idea how to put this together, I'd be grateful. Thanks

    
asked by anonymous 24.04.2015 / 17:28

1 answer

3

Adapt your idea with the functions date and strtotime

<?php

    echo date('d/m/Y H:i:s', strtotime('+100 hours', strtotime('24-04-2015 12:24:45')));
    
24.04.2015 / 19:28