I am trying to split up a string to stay under the limit of 70 characters... however, when i do this, my loop just stop right when it gets the first 70 characters and it doesn't attempt to do the 2nd set. The reason I'm going this route and not use str_split is to keep the entire words so I don't send out messages with half of a word. If the 2nd split has less than 70 characters, please still send it out...any kind of help with this is greatly appreciated.
$message="A new powerful earthquake convulsed the traumatized nation of Nepal on Tuesday, leveling buildings already damaged by the devastating quake that killed thousands of people less than three weeks ago."
$msg = explode(' ',$message);
foreach($msg as $key) {
$keylen = strlen($key);
$msglen = $msglen + $keylen;
if($msglen<70) {
$msgs .=$key." ";
// $agi->verbose("$msgs");
} else {
$params = array(
'src' => '18009993355',
'dst' => $callerid,
'text' => $msgs,
'type' => 'sms',
);
// $agi->verbose("sending: $msgs");
$response = $p->send_message($params);
$msgs = "";
$msglen = 0;
}
}
$msg<50???