function getTextPsi($type) { $psi3hr = array(); $psi24hr = array(); $comments = ""; getPsiData($psi3hr, $psi24hr, $comments); $psiData = $psi3hr; if ($type == "/psi24") { $psiData = $psi24hr; } $psiText = ""; if (count($psiData) > 0) { if ($type == "/psi") { $psiText = "3-hr PSI Reading : " . $psiData["main"] . "\n"; $psiText .= $psiData["timestamp"] . "\n"; } else { if ($type == "/psi3") { $psiText = "3-hr PSI Reading\n"; } else { if ($type == "/psi24") { $psiText = "24-hr PSI Reading\n"; } } $psiText .= $psiData["timestamp"] . "\n\n"; $psiText .= "North : " . $psiData["north"] . "\n"; $psiText .= "South : " . $psiData["south"] . "\n"; $psiText .= "East : " . $psiData["east"] . "\n"; $psiText .= "West : " . $psiData["west"] . "\n"; $psiText .= "Central : " . $psiData["central"] . "\n"; } } return $psiText; }
<?php header('Content-type: text/plain'); require_once '../inc/psiHelper.php'; $psi3hr = array(); $psi24hr = array(); $comments = ""; getPsiData($psi3hr, $psi24hr, $comments); echo '$psi3Hr '; print_r($psi3hr); echo "psi 3-Hr main reading: "; echo $psi3hr["main"]; echo "\n\n"; echo '$psi24Hr '; print_r($psi24hr); echo "\n\n"; echo getTextPsi("/psi"); echo "\n\n"; echo getTextPsi("/psi3"); echo "\n\n"; echo getTextPsi("/psi24"); echo "\n\n";