PHP array of strings seperated in columns to associative array [duplicate] - php

This question already has answers here:
Explode string by one or more spaces or tabs
(8 answers)
Closed 7 years ago.
I have unix disk output that I want to convert into an associated array for each line so a user can pick with available disks to use for the next vg creation.
Output of current array item. There is only 1 white space between each column I just did some tab's so it was easier to read.
array(11) {
[0]=> string(141) "vg1 LVM 136G /dev/cciss/c0d0p2 N/A N/A LOCAL N/A N/A NO "
[1]=> string(141) "vg2 LVM 1G /dev/mapper/mpath28p1 60060e80166fa70000016fa700000013 /dev/dm-33 R700 LS1000 0013 YES "
[2]=> string(141) "vg3 LVM 60G /dev/mapper/mpath27p1 60060e80166fa70000016fa700000012 /dev/dm-34 R700 LS1000 0012 YES "
[3]=> string(141) "vg4 LVM 60G /dev/mapper/mpath29p1 60060e80166fa70000016fa700000014 /dev/dm-35 R700 LS1000 0014 NO "
[4]=> string(141) "***AVAILABLE*** FREE 2G /dev/mapper/mpath21p1 60060e80167220000001722000000048 /dev/dm-37 R700 LS2000 0048 YES "
[5]=> string(141) "***AVAILABLE*** FREE 2G /dev/mapper/mpath22p1 60060e80167220000001722000000049 /dev/dm-36 R700 LS2000 0049 YES "
[6]=> string(141) "***AVAILABLE*** FREE 90G /dev/mapper/mpath23p1 60060e80166fa70000016fa70000000e /dev/dm-31 R700 LS1000 000e YES "
[7]=> string(141) "***AVAILABLE*** FREE 90G /dev/mapper/mpath24p1 60060e80166fa70000016fa70000000f /dev/dm-39 R700 LS1000 000f YES "
[8]=> string(141) "***AVAILABLE*** FREE 90G /dev/mapper/mpath25p1 60060e80166fa70000016fa700000010 /dev/dm-30 R700 LS1000 0010 YES "
[9]=> string(141) "***AVAILABLE*** FREE 90G /dev/mapper/mpath26p1 60060e80166fa70000016fa700000011 /dev/dm-32 R700 LS1000 0011 YES "
[10]=> string(141) "***AVAILABLE*** FREE 2G /dev/mapper/mpath30p1 60060e80167220000001722000000047 /dev/dm-38 R700 LS2000 0047 YES "
I want this to end up something like this. I've been trying different foreach loops but haven't got it to work yet. Any help/suggestions are appreciated.
[0] => name=>vg1 type=>LVM lun_size=>136G mpath_name=>/dev/cciss/c0d0p2 flun_id=>N/A dm_name=>N/A array_type=>LOCAL array_name=>N/A lun_id=>N/A shared=>NO
[1] => name=>vg2 type=>LVM lun_size=>1G mpath_name=>//dev/mapper/mpath28p1 flun_id=>60060e80166fa70000016fa700000013 dm_name=>/dev/dm-33 array_type=>R700 array_name=>LS1000 lun_id=>0013 shared=>NO
[2] => ....etc
Thanks

The solution is:
Loop through the original array elements
Use explode() function to split the string
Store elements in (key,value) pair in a temporary array
Push the temporary array at the appropriate position in the original array.
So your code should be like this:
// suppose $arr is your original array
$arrLength = count($arr);
for($i = 0; $i < $arrLength; ++$i){
$component_arr = explode(" ", $arr[$i]);
$tmp_arr = array();
$tmp_arr['name'] = $component_arr[0];
$tmp_arr['type'] = $component_arr[1];
$tmp_arr['lun_size'] = $component_arr[2];
$tmp_arr['mpath_name'] = $component_arr[3];
$tmp_arr['flun_id'] = $component_arr[4];
$tmp_arr['dm_name'] = $component_arr[5];
$tmp_arr['array_type'] = $component_arr[6];
$tmp_arr['array_name'] = $component_arr[7];
$tmp_arr['lun_id'] = $component_arr[8];
$tmp_arr['shared'] = $component_arr[9];
unset($arr[$i]);
$arr[$i] = $tmp_arr;
}
// display $arr array
var_dump($arr);

If they are tabs you should be able to use:
foreach($array as $row) {
$pieces = explode("\t",$row);
}

The sorting them out is the issue. The following gives me this. I'm not sure if I need to now use another foreach within there a combine of some sort. I'm been looking at examples but haven't found anything that has a string with that many fields.
foreach($disks as $row){
$arraynew = explode("\t", $row);
print_r($arraynew);
}
Array ( [0] => vg00 LVM 136G /dev/cciss/c0d0p2 N/A N/A LOCAL N/A N/A NO )
Array ( [0] => vg01 LVM 1G /dev/mapper/mpath28p1 60060e80013 /dev/dm-33 R700 LS4P991 0013 YES )

If it is accurate that the columns are only separated by 1 white space, I could suggest something along the lines of:
$result = Array();
foreach($main_array as $string){
$array = explode(" ", $string);
//now here you can sort them in the new array however you wish with the appropriate index and value.
}
Explode by space, " ", not tab, "\t"

Related

PHP: Custom parser for non-formatted text

I am trying to create a project which will help students study various areas. The idea is that I have a piece of raw text, which contains quiz questions and answers which I want to parse as question header and answer options, which will be inserted into a database. However, the text is not properly formatted and due to the large amount of questions and answers (around ~20k per total), I cannot afford the time to manually insert them or format the text myself.
The raw text looks like this:
1. A car averages 27 miles per gallon. If gas costs $4.04 per gallon, which of the following is closest to how much the gas would cost for this car to travel 2,727 typical miles?
a) $44.44 b) $109.08 c) $118.80
d) $408.04 e)
$444.40
2. When x = 3 and y = 5, by how much does the value of 3x2 – 2y exceed the value of 2x2 – 3y ?
a) 4
b) 14
c) 16
d) 20 e) 50
I tried creating my own PHP functions to parse the text properly, however I cannot get myself to get past the random line breaks, spaces, etc.
What I am trying to obtain:
array(1) {
[0]=>
array(3) {
["questionNumber"]=>
string(1) "1"
["questionText"]=>
string(175) "A car averages 27 miles per gallon. If gas costs $4.04 per gallon, which of the following is closest to how much the gas would cost for this car to travel 2,727 typical miles?"
["options"]=>
array(5) {
["a"]=>
string(6) "$44.44"
["b"]=>
string(7) "$109.08"
["c"]=>
string(7) "$118.80"
["d"]=>
string(7) "$408.04"
["e"]=>
string(7) "$444.40"
}
}
}
The code I have so far:
$rawText = '1. A car averages 27 miles per gallon. If gas costs $4.04 per gallon, which of the following is closest to how much the gas would cost for this car to travel 2,727 typical miles?
a) $44.44 b) $109.08 c) $118.80
d) $408.04 e)
$444.40
2. When x = 3 and y = 5, by how much does the value of 3x2 – 2y exceed the value of 2x2 – 3y ?
a) 4
b) 14
c) 16
d) 20 e) 50
';
$rawTextLines = explode("\n", $rawText);
foreach ($rawTextLines as $lineNumber => $lineContents) {
$lContents = trim($lineContents);
if (empty ($lContents)) {
unset ($rawTextLines[$lineNumber]);
} else {
$rawTextLines[$lineNumber] = $lContents;
}
}
$processedQuestions = array ();
$currentQuestionHeader = 0;
foreach ($rawTextLines as $lineNumber => $lineContents) {
if (ctype_digit(substr($lineContents, 0, 1))) { // Question header
$questionHeaderInformation = explode('.', $lineContents);
$currentQuestionHeader = $questionHeaderInformation[0];
$processedQuestions[$currentQuestionHeader]['questionNumber'] = $currentQuestionHeader;
$processedQuestions[$currentQuestionHeader]['questionText'] = $questionHeaderInformation[1];
} else { // Question option
$options = explode(')', $lineContents);
if (count ($options) % 2 === 0) {
$processedQuestions[$currentQuestionHeader]['options'][trim($options[0])] = ucfirst(trim($options[1]));
} else {
}
}
}
Which produces this:
array(2) {
[1]=>
array(3) {
["questionNumber"]=>
string(1) "1"
["questionText"]=>
string(35) " A car averages 27 miles per gallon"
["options"]=>
array(1) {
["a"]=>
string(8) "$44.44 b"
}
}
[2]=>
array(3) {
["questionNumber"]=>
string(1) "2"
["questionText"]=>
string(96) " When x = 3 and y = 5, by how much does the value of 3x2 – 2y exceed the value of 2x2 – 3y ?"
["options"]=>
array(3) {
["a"]=>
string(1) "4"
["b"]=>
string(2) "14"
["c"]=>
string(2) "16"
}
}
}
As you can see, the current output does not match - not by far, what I am trying to obtain.
Thank you in advance.
Hellow,
^[0-9]+\. (.*)[\r\n]+a\)[\s]+(.*)[\s]+b\)[\s]+(.*)[\s]+c\)[\s]+(.*)[\s]+d\)[\s]+(.*)[\s]+e\)[\s]+(.*)[\s]*
Try it !
$re = '/^[0-9]+\. (.*)[\r\n]+a\)[\s]+(.*)[\s]+b\)[\s]+(.*)[\s]+c\)[\s]+(.*) [\s]+d\)[\s]+(.*)[\s]+e\)[\s]+(.*)[\s]*/m';
$str = '1. A car averages 27 miles per gallon. If gas costs $4.04 per gallon, which of the following is closest to how much the gas would cost for this car to travel 2,727 typical miles?
a) $44.44 b) $109.08 c) $118.80
d) $408.04 e)
$444.40
2. When x = 3 and y = 5, by how much does the value of 3x2 – 2y exceed the value of 2x2 – 3y ?
a) 4
b) 14
c) 16
d) 20 e) 50';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);

Array from text file return lots of empty space using php

Currently I'm trying to extract data from a text file that generated from a .asp website that will be load into interface.txt file. Format of the data are below (All the name in the text has been masked):
format of data in text file split by comma
801B,SAMPING,VAC,25999,2,R**NA** B**T* A** R*H** ,FEMALE,2017-05-29, ,14:58:01.8000000
820A,SAMPING,VAC,11191,5,M**A*M** H*I**L B** K*M**R*LBA**R*N ,MALE,2017-05-31, ,20:33:19.0300000
505,SELENDANG,OCC,26194,2,I*F** *MR** B** M**D H**A* *AK*R**D** ,MALE,2017-06-01, ,17:49:54.6530000
810,SAMPING,VAC,14251,6,P**I** B**T* S*L**H ,FEMALE,2017-05-29, ,00:10:47.8630000
602B,SUTERA,OCC,26172,2,G**R*E C**E K** Z** ,MALE,2017-06-01, ,15:22:18.9970000
By using below codes, I'm trying to extract the data:
$file = "C:/btemp/bed-interface.txt";
$fileToLoad = fopen($file, "rb");
while(!feof($fileToLoad)){
$data = fgets($fileToLoad);
$extract = array_map('trim', explode(',', $data));
$bnum = trim(preg_replace('[^\s]', '', $extract[0]));
//other array continue here
}
fclose($fileToLoad);
Above codes will split the string by using comma but then when I'm trying to check each array strlen return, it will shows the incorrect value. For example, the first row data when return the $bnum it will show strlen of 7 instead 4. This will continue to other data. Can refer to below image to see the result of each return character. Each length are is in bracket. (All the name in the text has been masked)
801B (7) SAMPING (13) O 25999 (9) 2 (1) R**NA** B**T* A** R*H** (45) F 2017-05-29 (19) 14:58:01 (15)
820A (7) SAMPING (13) O 11191 (9) 5 (1) M**A*M** H*I**L B** K*M**R*LBA**R*N (69) F 2017-05-31 (19) 20:33:19 (15)
505 (5) SELENDANG (17) O 26194 (9) 2 (1) I*F** *MR** B** M**D H**A* *AK*R**D** (73) F 2017-06-01 (19) 17:49:54 (15)
810 (5) SAMPING (13) O 14251 (9) 6 (1) P**I** B**T* S*L**H (37) F 2017-05-29 (19) 00:10:47 (15)
602B (7) SUTERA (11) O 26172 (9) 2 (1) G**R*E C**E K** Z** (37) F 2017-06-01 (19) 15:22:18 (15)
Result of explode and length of each array return
So, how to prevent this to happen. How to remove all the space. Already tried using trim, array_map, preg_replace still space appear when count using strlen. Even to do match in mysql query, it will return false cause the space has made the query return false.
After investigating the value that has been sent to the database, seems that all the character in the database has unknown character after every each value.
For example SAMPING = S□A□M□P□I□N□G□ (there will be □ as unknown char and will read by strlen as 14 character)
By using correct preg_replace for each array retrieve:
$bnum = preg_replace('/[^A-Za-z0-9_ -]/','',$extract[0]);
instead of this:
$bnum = trim(preg_replace('[^\s]', '', $extract[0]));
it will remove all unwanted unknown character in the array and will save the correct value to the database.

PHP - Read a result txt file to get vars

what I'm trying to do looks impossible with my actual PHP skills. Below you can find an exemple of a race result file, in txt. This file is composed of :
dir= the-track-file-name
longname= the-track-long-name-with-spaces
firstlap= the number of gate (checkpoint) the first lap is composed of
normallap= the number of gate (checkpoint) other laps are composed of
holeshotindex= thefirst gate after the start, which determine which player started first
time= the race duration, in minutes
laps= the number of laps (if minutes + laps, laps are counted when time's up)
starttime=1793
date= timestamp of the start
players:(under this line are all the player, just 1 in this exemple)
slot=0 (this is the multiplayer server slot taken by the player)
uid=5488 (this is the unique ID of the player)
number=755 (player's race number)
bike=rm125 (player's motorbike model)
name=Nico #755(player's name)
times: (under this line are things like timestamps of every gate, like SLOT|GATE|TIME)
0 0 1917 (it's like divide the timstamp /128 sounds good)
0 1 2184
(and etc, see full exemple below...)
The game server is on a dedicated ubuntu.
At each race end I send these results on an FTP web server, and what I need is to get vars to output something readable like a table with results after selecting a race (in a dropdown list i.e.).
Doing the table isn't the problem.
My problem is, even searching a lot here, that I don't know how to read the txt to obtain this kind of page (only RESULTS table) : http://mxsimulator.com/servers/q2.MXSConcept.com/races/6015.html
Here is a full sample result file : http://www.mediafire.com/view/3b34a4kd5nfsj4r/sample_result_file.txt
Thank you
Ok, tonight it's file parsing time.
I've written a very basic parser, which walks through the data line by line.
First it looks for "=". When a "=" is found the line is split/exploded at "=".
You get two parts: before and after the "=".
I've used them as key and value in an $results array.
This process continues till we reach the line "times:".
That's the line indicating that on the next line (line "times:" + 1) the results start.
The results are "slot gate time" separated by spaces. So the results are exploded with " " (space) this time and you get the three parts.
I've inserted an array key 'times' which contains an array with named keys (slot,gate,time).
You might just look at the structure of the $results array.
It should be very easy to iterate over it to render a table or output data.
#$datafile = 'http://www.mediafire.com/view/3b34a4kd5nfsj4r/sample_result_file.txt';
#$lines = file_get_contents($datafile);
$lines = '
dir=Dardon-Gueugnon
longname=Dardon Gueugnon
firstlap=72
normallap=71
holeshotindex=1
time=0
laps=6
starttime=1846
date=1407162774
players:
slot=0
uid=8240
number=172
bike=rm125
name=Maximilien Jannot | RH-Factory
slot=1
uid=7910
number=666
bike=rm125
name=Patrick Corvisier|Team RH-Factory
slot=2
uid=10380
number=114
bike=rm125
name=Benoit Krawiec | MXS-Concept.com
slot=6
uid=6037
number=59
bike=rm125
name=Yohan Levrage | SPEED
slot=8
uid=6932
number=447
bike=rm125
name=Morgan Marlet | Mxs-Concept.com
times:
6 0 1974
1 0 1989
0 0 2020
2 0 2056
6 1 2242
1 1 2260
0 1 2313
2 1 2338
6 2 2434
1 2 2452';
$results = array();
$parseResults = false;
#foreach($lines as $line){ // use this line when working with file_get_contents
foreach(preg_split("/((\r?\n)|(\r\n?))/", $lines) as $line){
if($parseResults === true) {
$parts = explode(' ', $line); // SLOT|GATE|TIME = parts 0|1|2
$times = array(
'slot' => $parts[0],
'gate' => $parts[1],
'time' => $parts[2]
);
$results['times'][] = $times;
}
if(false !== strpos($line, '=')) { // if line has a = in it, explode it
$parts = explode('=', $line);
$results[$parts[0]] = $parts[1]; // assign parts to array as key=value
}
if(false !== strpos($line, 'times:')) {
// we reached "times:", let's set a flag to start reading results in the next iteration
$parseResults = true;
}
}
var_dump($results);
Output:
array(15) {
["dir"]=> string(15) "Dardon-Gueugnon"
["longname"]=> string(15) "Dardon Gueugnon"
....
["name"]=> string(31) "Morgan Marlet | Mxs-Concept.com"
["times"]=> array(10) {
[0]=> array(3) { ["slot"]=> string(1) "6" ["gate"]=> string(1) "0" ["time"]=> string(4) "1974" }
[1]=> array(3) { ["slot"]=> string(1) "1" ["gate"]=> string(1) "0" ["time"]=> string(4) "1989" }
[2]=> array(3) { ["slot"]=> string(1) "0" ["gate"]=> string(1) "0" ["time"]=> string(4) "2020" }
...
} } }

How to make 5 random numbers with sum of 100 [duplicate]

This question already has answers here:
Getting N random numbers whose sum is M
(9 answers)
Closed 1 year ago.
do you know a way to split an integer into say... 5 groups.
Each group total must be at random but the total of them must equal a fixed number.
for example I have "100" I wanna split this number into
1- 20
2- 3
3- 34
4- 15
5- 18
EDIT: i forgot to say that yes a balance would be a good thing.I suppose this could be done by making a if statement blocking any number above 30 instance.
I have a slightly different approach to some of the answers here. I create a loose percentage based on the number of items you want to sum, and then plus or minus 10% on a random basis.
I then do this n-1 times (n is total of iterations), so you have a remainder. The remainder is then the last number, which isn't itself truley random, but it's based off other random numbers.
Works pretty well.
/**
* Calculate n random numbers that sum y.
* Function calculates a percentage based on the number
* required, gives a random number around that number, then
* deducts the rest from the total for the final number.
* Final number cannot be truely random, as it's a fixed total,
* but it will appear random, as it's based on other random
* values.
*
* #author Mike Griffiths
* #return Array
*/
private function _random_numbers_sum($num_numbers=3, $total=500)
{
$numbers = [];
$loose_pcc = $total / $num_numbers;
for($i = 1; $i < $num_numbers; $i++) {
// Random number +/- 10%
$ten_pcc = $loose_pcc * 0.1;
$rand_num = mt_rand( ($loose_pcc - $ten_pcc), ($loose_pcc + $ten_pcc) );
$numbers[] = $rand_num;
}
// $numbers now contains 1 less number than it should do, sum
// all the numbers and use the difference as final number.
$numbers_total = array_sum($numbers);
$numbers[] = $total - $numbers_total;
return $numbers;
}
This:
$random = $this->_random_numbers_sum();
echo 'Total: '. array_sum($random) ."\n";
print_r($random);
Outputs:
Total: 500
Array
(
[0] => 167
[1] => 164
[2] => 169
)
Pick 4 random numbers, each around an average of 20 (with distribution of e.g. around 40% of 20, i.e. 8). Add a fifth number such that the total is 100.
In response to several other answers here, in fact the last number cannot be random, because the sum is fixed. As an explanation, in below image, there are only 4 points (smaller ticks) that can be randomly choosen, represented accumulatively with each adding a random number around the mean of all (total/n, 20) to have a sum of 100. The result is 5 spacings, representing the 5 random numbers you are looking for.
Depending on how random you need it to be and how resource rich is the environment you plan to run the script, you might try the following approach.
<?php
set_time_limit(10);
$number_of_groups = 5;
$sum_to = 100;
$groups = array();
$group = 0;
while(array_sum($groups) != $sum_to)
{
$groups[$group] = mt_rand(0, $sum_to/mt_rand(1,5));
if(++$group == $number_of_groups)
{
$group = 0;
}
}
The example of generated result, will look something like this. Pretty random.
[root#server ~]# php /var/www/dev/test.php
array(5) {
[0]=>
int(11)
[1]=>
int(2)
[2]=>
int(13)
[3]=>
int(9)
[4]=>
int(65)
}
[root#server ~]# php /var/www/dev/test.php
array(5) {
[0]=>
int(9)
[1]=>
int(29)
[2]=>
int(21)
[3]=>
int(27)
[4]=>
int(14)
}
[root#server ~]# php /var/www/dev/test.php
array(5) {
[0]=>
int(18)
[1]=>
int(26)
[2]=>
int(2)
[3]=>
int(5)
[4]=>
int(49)
}
[root#server ~]# php /var/www/dev/test.php
array(5) {
[0]=>
int(20)
[1]=>
int(25)
[2]=>
int(27)
[3]=>
int(26)
[4]=>
int(2)
}
[root#server ~]# php /var/www/dev/test.php
array(5) {
[0]=>
int(9)
[1]=>
int(18)
[2]=>
int(56)
[3]=>
int(12)
[4]=>
int(5)
}
[root#server ~]# php /var/www/dev/test.php
array(5) {
[0]=>
int(0)
[1]=>
int(50)
[2]=>
int(25)
[3]=>
int(17)
[4]=>
int(8)
}
[root#server ~]# php /var/www/dev/test.php
array(5) {
[0]=>
int(17)
[1]=>
int(43)
[2]=>
int(20)
[3]=>
int(3)
[4]=>
int(17)
}
$number = 100;
$numbers = array();
$iteration = 0;
while($number > 0 && $iteration < 5) {
$sub_number = rand(1,$number);
if (in_array($sub_number, $numbers)) {
continue;
}
$iteration++;
$number -= $sub_number;
$numbers[] = $sub_number;
}
if ($number != 0) {
$numbers[] = $number;
}
print_r($numbers);
This should do what you need:
<?php
$tot = 100;
$groups = 5;
$numbers = array();
for($i = 1; $i < $groups; $i++) {
$num = rand(1, $tot-($groups-$i));
$tot -= $num;
$numbers[] = $num;
}
$numbers[] = $tot;
It won't give you a truly balanced distribution, though, since the first numbers will on average be larger.
I think the trick to this is to keep setting the ceiling for your random # generator to 100 - currentTotal
The solution depends on how random you want your values to be, in other words, what random situation you're going to simulate.
To get totally random distribution, you'll have to do 100 polls in which each element will be binded to a group, in symbolic language
foreach i from 1 to n
group[ random(1,n) ] ++;
For bigger numbers, you could increase the selected group by random(1, n/100) or something like that until the total sum would match the n.
However, you want to get the balance, so I think the best for you would be the normal distribution. Draw 5 gaussian values, which will divide the number (their sum) into 5 parts. Now you need to scale this parts so that their sum would be n and round them, so you got your 5 groups.
The solution I found to this problem is a little different but makes makes more sense to me, so in this example I generate an array of numbers that add up to 960. Hope this is helpful.
// the range of the array
$arry = range(1, 999, 1);
// howmany numbers do you want
$nrresult = 3;
do {
//select three numbers from the array
$arry_rand = array_rand ( $arry, $nrresult );
$arry_fin = array_sum($arry_rand);
// dont stop till they sum 960
} while ( $arry_fin != 960 );
//to see the results
foreach ($arry_rand as $aryid) {
echo $arryid . '+ ';
}

PHP is not returning me a number type

I tried to follow the instructions in this question: STAR rating with css
but I've just a big problem.
When I do:
<span class="stars">1.75</span>
or
$foo='1.75';
echo '<span class="stars">'.$foo.'</span>
the stars is correctly shown, but as soon as I do:
while($val = mysql_fetch_array($result))
{
$average = ($val['services'] + $val['serviceCli'] + $val['interface'] + $val['qualite'] + $val['rapport'] ) / 5 ;
<span class="stars">.$average.</span>
}
the stars stops working
I double checked the data type in mysql:
they're all TINYINT(2)
and I tried this:
$average = intval($average);
but it's still not working,
I think your problem may be that the value you have is greater than the 5 allowed in that example.
What you want to do is weight the items such that the total for $average is less than or equal to 5.
$average = (
( $val['services'] / $maxServices )
+ ( $val['serviceCli'] / $maxServiceCli )
+ ( $val['interface'] / $maxInterface )
+ ( $val['qualite'] / $maxQualite )
+ ( $val['rapport'] / $maxRapport )
);
The weighting could be even, so each of the values will be less than or equal to 1, or they could have different weights so services is worth more than qualite (and so on).
no, var_dump($val) gives me ALL the value i get from my big request (text, varchar, int) [example :
array(38) { [0]=> string(28) "http://www.crystal-serv.com/"
["siteweb"]=> string(28) "http://www.crystal-serv.com/"
[1]=> string(1) "0" ["offreDedie"]=> string(100)
"tick rouge" [2]=> string(1) "0" ["coupon"]=>
..........

Categories