trim($parts[0]), "Box" => trim($parts[1]), "Win Rate" => (float) trim($parts[2]), "Place Odds" => (float) trim($parts[3]), ]; } } // Calculate rankings and recommendations $trifecta = array_slice(array_column($processed_data, 'Dog Name'), 0, 3); $quinella = array_slice(array_column($processed_data, 'Dog Name'), 0, 2); echo "

Race Predictions

"; echo ""; echo ""; foreach ($processed_data as $entry) { $stake = $entry["Place Odds"] > 1 ? round(5 / ($entry["Place Odds"] - 1), 2) : 'N/A'; echo ""; } echo "
Dog NameBoxWin RatePlace OddsStake
{$entry['Dog Name']} {$entry['Box']} {$entry['Win Rate']} {$entry['Place Odds']} {$stake}
"; echo "

Trifecta Prediction

"; echo implode(", ", $trifecta); echo "

Quinella Prediction

"; echo implode(", ", $quinella); } else { // Display upload form echo '



'; } return ob_get_clean(); } add_shortcode('greyhound_race_tool', 'greyhound_race_tool_shortcode');