foreach ($response as $tweet) { $happyValue = 0; $tweetArray = explode(" ", $tweet['text']); //explode tweet into Array $tweetArray = preg_replace("/[^a-zA-Z 0-9]+/", "", $tweetArray); // Remove punctuations $tweetArray = array_filter($tweetArray); //Remove all empty elements $tweetArray = array_values($tweetArray); //Re-key array numerically for ($i = 0; $i < count($tweetArray); $i++) { //for each item in tweetArray, check if it is in happyWords, if yes, happyValue++ if (in_array_case_insensitive($tweetArray[$i], $happyWords)) { $happyValue++; } if (in_array_case_insensitive($tweetArray[$i], $sadWords)) { //for each item in tweetArray, check if it is in happyWords, if yes, happyValue-- $happyValue--; } // echo "[".$i."]"; // echo "<b>".$happyValue."</b>"; } // echo "<br>"; // for($i = 0;$i < count($tweetArray);$i++){ // echo $i.$tweetArray[$i]." "; // } // echo "<br>"; array_push($happyValueArray, $happyValue); //add tweet's happyValue to $happyValueArray } function printTweet($tweet, $boolean, $key)
$searchArray[] = $cName; $searchArray[] = $term->name; } } // Run through the ZipCodes if (have_rows('zip_codes', 'location_' . $ID)) { while (have_rows('zip_codes', 'location_' . $ID)) { the_row(); $i++; $zip = get_sub_field('zip_code'); // Add Zips to Search Array $searchArray[] = $zip; } } // Conditional to see if we have a match if (in_array_case_insensitive($location, $searchArray)) { // Region $relatedArea = get_field('related_region', 'location_' . $ID); echo '<div class="entry-content">'; echo '<h2><strong>' . $location . '</strong> is in our Little Friends region of ' . $term->name . '</h2>'; echo '<div class="gottoregion"><a href="' . $relatedArea . '">Go</a></div>'; echo '</div>'; // set a variable if we got a match. $match = 'yes'; break; // get outta here } else { // else start over and try again. unset($searchArray); $searchArray = array(); $match = '';