<?php    
function twiml_say($message) {
$tmp="<Say voice='woman'>".$message. "</Say>"    ;
return $tmp;
}
function twiml_gather($ndigits,$action,$method,$saymessage=false) {
$tmp="<Gather numDigits=\"$ndigits\" action=\"$action\" method=\"$method\" timeout=\"30\">";
if (isset($saymessage)) {
$tmp=$tmp .twiml_say($saymessage);
}
$tmp=$tmp . "</Gather>"   ;
return $tmp;
}

function twiml_hangup() {
  $tmp="<Hangup></Hangup>";  
}

function padnumberswithspace($numstr) {
  $tmp=str_replace(array('0','1', '2', '3','4','5','6','7','8','9'), array('0,','1,','2,','3,','4,','5,','6,','7,','8,','9,'),$numstr ) ;
  return $tmp;    
}

function get_storeinfo($srcharr, $phoneno, $item) {
//echo $phoneno;
//echo $item; 

 $tmp=$srcharr[$phoneno][$item];
//echo $tmp;
    return $tmp;
}

function sendsms($account,$auth,$from,$to,$body,$purl='') {
   $AccountSid=$account;
   $AuthToken=$auth;
   $client = new Services_Twilio($AccountSid, $AuthToken);
   $message=$client->account->sms_messages->create($from, $to, $body,array('StatusCallback' => $purl));
   $tmp=$message->sid;
   return $tmp;
}

function printArray($array){
     foreach ($array as $key => $value){
        echo "$key => $value";
        if(is_array($value)){ //If $value is an array, print it as well!
            printArray($value);
        }  
    } 
} 

function isholiday($dttocchk,$holidayarray,$closedarray){

    $stat='REG';
    $c=strtotime($dttocchk);
    $txt=date('l',$c);
    $i=array_search($txt, $closedarray);
    if ($i>-1){
        $stat='HOL';
    }
    $txt=date('Y-m-d',$c);
    $i=array_search($txt, $holidayarray);
    if ($i>-1) {
        $stat='HOL';
    } 
   return $stat;
    
}






?>