@ 2020-06-23T00:54:29Z <?php
$results = array (
0 =>
array (
'id' => 1,
'location' => 3,
'location_fees' => 3,
'gross_percentage' => 25,
'transaction_percentage' => 0,
'user_name' => 'admin',
'user_id' => 1,
'gross' => 'yes',
'transaction' => 'no'
),
1 =>
array (
'id' => 2,
'location' => 5,
'location_fees' => 5,
'gross_percentage' => 0,
'transaction_percentage' => 24,
'user_name' => 'admin',
'user_id' => 1,
'gross' => 'no',
'transaction' => 'yes'
),
2 =>
array (
'id' => 3,
'location' => 2,
'location_fees' => 5,
'gross_percentage' => 10,
'transaction_percentage' => 0,
'user_name' => 'admin',
'user_id' => 1,
'gross' => 'yes',
'transaction' => 'no'
)
);
$search = ['gross' => 'yes'];
foreach ($results as $k => $v) {
echo "key $k<br>" . PHP_EOL;
if ($v['gross'] == $search['gross'] ) {
$location_fees = $v['location_fees'];
echo "The location fees: ". $location_fees ." % <br><br>" . PHP_EOL;
$gross_percentage = $v['gross_percentage'];
echo "The gross_percentage is: ".$gross_percentage ."% <br><br>" . PHP_EOL;
} else {
$tran_perc = $v['transaction_percentage'];
echo "The locations percentage is: ".$tran_perc ." % <br>" . PHP_EOL;
$the_loc = $v['location'];
echo "The location is: ".$the_loc ." <br>" . PHP_EOL;
$location_fees = $v['location_fees'];
echo "The location fees: ". $location_fees ." % <br><br>" . PHP_EOL;
}
}
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 5.4.0 - 5.4.45 , 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 , 7.0.0 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.31 , 8.2.0 - 8.2.26 , 8.3.0 - 8.3.14 , 8.4.1 key 0<br>
The location fees: 3 % <br><br>
The gross_percentage is: 25% <br><br>
key 1<br>
The locations percentage is: 24 % <br>
The location is: 5 <br>
The location fees: 5 % <br><br>
key 2<br>
The location fees: 5 % <br><br>
The gross_percentage is: 10% <br><br>
Output for 4.4.2 - 4.4.9 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 Parse error: syntax error, unexpected '[' in /in/gTBf7 on line 42
Process exited with code 255 . Output for 4.3.0 - 4.3.1 , 4.3.5 - 4.3.11 , 4.4.0 - 4.4.1 , 5.0.0 - 5.0.5 Parse error: parse error, unexpected '[' in /in/gTBf7 on line 42
Process exited with code 255 . Output for 4.3.2 - 4.3.4 Parse error: parse error in /in/gTBf7 on line 42
Process exited with code 255 . preferences:dark mode live preview
105.55 ms | 409 KiB | 5 Q