|
Revision 152, 0.8 kB
(checked in by kstemen, 7 years ago)
|
|
Scaling, categorization, and selecting materials have been fixed since Jorge's submission. All code should use db_get_plot_single_values now, but the old function is still around.
|
-
Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 | <?
|
|---|
| 2 | if(version_compare(phpversion(),"5.0.0","<"))
|
|---|
| 3 | {
|
|---|
| 4 | function array_combine($array_keys, $array_values) {
|
|---|
| 5 | $t = array();
|
|---|
| 6 | $size = count($array_keys);
|
|---|
| 7 | if (($size != count($array_values)) || ($size == 0)) return false;
|
|---|
| 8 | for ($x = 0, $key = array_values($array_keys),
|
|---|
| 9 | $value = array_values($array_values); $x < $size; $x++) {
|
|---|
| 10 | $t[$key[$x]] = $value[$x];
|
|---|
| 11 | }
|
|---|
| 12 | return $t;
|
|---|
| 13 | }
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | // Not very efficient, but should be good enough for 100 materials, right?
|
|---|
| 17 |
|
|---|
| 18 | function array_mult($array1,$array2){
|
|---|
| 19 |
|
|---|
| 20 | $mult = array();
|
|---|
| 21 |
|
|---|
| 22 | for($i=0;$i<count($array1);$i++){
|
|---|
| 23 | array_push($mult,$array1[$i]*$array2[$i]);
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | return $mult;
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 | function array_div($array1,$array2){
|
|---|
| 30 |
|
|---|
| 31 | $div = array();
|
|---|
| 32 |
|
|---|
| 33 | for($i=0;$i<count($array1);$i++){
|
|---|
| 34 | array_push($div,$array1[$i]*$array2[$i]);
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | return $div;
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 | ?>
|
|---|