Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/28/2023 in all areas

  1. I agree with Gizmola^. Using a multidimensional array ... $probs = [ 'QB' => [ 'RB' => [ 1 => 11.22, 2 => 3.91, 3 => 0.15 ], 'TE' => [ 1 => 5.17, 2 => 0.80, 3 => 0.00 ], 'QB' => [ 1 => 9.44, 2 => 0.00, 3 => 0.00 ], 'WR' => [ 1 => 10.46, 2 => 8.67, 3 => 4.53 ], 'K' => [ 1 => 3.81, 2 => 0.19, 3 => 0.00 ], 'D' => [ 1 => 2.85, 2 => 0.07, 3 => 0.00 ] ] // rinse and repeat with the other MVPs and FLEXs ]; $lineup = 'QB, WR, WR, RB, K'; $arr = array_map('trim', explode(',', $lineup)); $mvp = array_shift($arr); $counts = array_count_values($arr); $probability = 0; foreach ($counts as $p => $n) { $probability += $probs[$mvp][$p][$n]; } echo '<br>'.$probability; // 23.7
    1 point
  2. I'm not entirely sure what you are asking here, but PHP has arrays that are extremely flexible. An array element can contain a nested array, and you can also have multi-dimensional arrays. You can also mix arrays and class objects together, as in having a class, creating an object of that class and assigning it to an array, such that you have an array of objects. Either of these ideas could help you represent the data you have in your table. Arrays can be easily traversed using for loops or foreach.
    1 point
  3. It seems like the variable $siteOwnersEmail is used, but its value is not defined in your provided code. You need to set the email address where you want to receive the form submissions. Add the following line at the beginning of your script, before the if($_POST) line: $siteOwnersEmail = 'your-email@example.com'; Replace 'your-email@example.com' with the actual email address where you want to receive the form submissions. Additionally, there's a small error in your code. You're using $Name in your message concatenation, but the variable is actually $name (lowercase). Update the line to: $message .= "Email from: " . $name . "<br />"; After making these changes, your script should work better.
    1 point
This leaderboard is set to New York/GMT-05:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.