Sandbird

Untitled

Sep 1st, 2021
953
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function get_string_between($string, $start = "", $end = ""){
  2.   if (strpos($string, $start)) { // required if $start doesnt exist in $string
  3.       $startCharCount = strpos($string, $start) + strlen($start);
  4.       $firstSubStr = substr($string, $startCharCount, strlen($string));
  5.       $endCharCount = strpos($firstSubStr, $end);
  6.       if ($endCharCount == 0) {
  7.           $endCharCount = strlen($firstSubStr);
  8.       }
  9.       return substr($firstSubStr, 0, $endCharCount);
  10.   } else {
  11.       return '';
  12.   }
  13. }
  14.  
  15. //Pos psaxno gia ta New cases sto pdf
  16. //new_cases            
  17. $new_cases = trim(get_string_between($fulltext, 'νόσου είναι', ', εκ'));
  18. if($new_cases == ""){
  19.     $new_cases = trim(get_string_between($fulltext, 'κρούσματατης νόσου είναι', '.'));
  20.     if($new_cases == ""){
  21.         $new_cases = trim(get_string_between($fulltext, 'νόσου αυξήθηκαν κατά', '.'));
  22.         if($new_cases == ""){
  23.             $new_cases = trim(get_string_between($fulltext, 'κρούσματατηςνόσουείναι', ','));
  24.             if($new_cases == ""){
  25.                 $new_cases = trim(get_string_between($fulltext, 'κρούσματατηςνόσουείναι', '.'));
  26.                 if($new_cases == ""){
  27.                     $new_cases = trim(get_string_between($fulltext, 'καταγράφηκαν τις τελευταίες 24 ώρες είναι', ','));
  28.                 }
  29.             }
  30.         }
  31.     }
  32. }
  33.  
RAW Paste Data