You are here: Re: Processing and adding numbers from lines. « PHP Programming Language « IT news, forums, messages
Re: Processing and adding numbers from lines.

Posted by NC on 10/07/13 11:36

sanfranc415@gmail.com wrote:
>
> .90 is the percent that 20 is of 220.

Not really... 20 is 9.090909...% of 220...

> Do you have a sample that might lead me the right direction?

Let's see...

$line1 = 'test test test description (100-10-0, 6700 test)';
$line2 = 'test test test description (100-10-0, 6350 test)';
list(, $temp) = explode('(', $line1);
list($temp,) = explode(',', $temp);
list($n11, $n12, $n13) = explode('-', $temp);
list(, $temp) = explode('(', $line2);
list($temp,) = explode(',', $temp);
list($n21, $n22, $n23) = explode('-', $temp);
echo $n11+$n21, '-', $n12+$n22, ' ',
number_format(1-($n12+$n22)/($n11+$n21+$n12+$n22),4);

That's it, really...

Cheers,
NC

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация