I am trying to take 2 strings, see what length they are, and if one is larger than the other, set it as $phonenumber
, and the other as $extension
. See below:
if(strlen($temp_ext) > 4)
{
$extension = $temp_cid;
$phonenumber = $temp_ext;
}
else
{
$extension = $temp_ext;
$phonenumber = $temp_cid;
}
This doesn't look like it works, though. I am still getting 10 digit numbers in extension, and 4 digit numbers in the $phonenumber
variable. What am I missing?
Try this
if(strlen($temp_ext) > strlen($temp_cid))
{
$extension = $temp_cid;
$phonenumber = $temp_ext;
}
else
{
$extension = $temp_ext;
$phonenumber = $temp_cid;
}
Hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.