Question: I have been using the code below to send sms to customers telling them their account balances after a given period. so far the code is able to send sms to one person at a time. Can i modify the code to send the message to all customers.

```
<?php

function sendsms($sms_username,$sms_password,$sender_ID,$number,$message)
{
    if(isset($sms_username) && isset($sms_password))
    {
        $username = trim($sms_username);//your sms user account
        $password = trim($sms_password);//your sms password
        $type = '0';//FOR FLASH MESSAGES SET type to 1
        $dlr = '1';//request for delivery report
        $destination = $number;;//phone number 
        $source = urlencode($sender_ID);//This is the sender or label that will be received by client/user. MAXIMUM 11 CHARACTERS
        $message = urlencode("$message");//message content to be sent to user/client

        //Form url api
        $url = "https://api.sendingthesms/bulksms/?username=" .$username."&password=".$password."&type=0&dlr=1&destination=".$destination."&source=".$source."&message=" . $message;

        $scc = stream_context_create(array('http' => array('protocol_version' => 1.1)));//enforce http 1.1
        $response = file_get_contents("$url",0,$scc);//fire/call nalo sms api

        return $response;
    }else
    {
        return "username cannot be empty";
    }
}

echo sendsms("username","mypassword","$session_username",$mainphone3, $mysms);
header("location:index.php");
            exit;
?>

```

Answer: 
-First, you can change your if statement with the condition if your loop at the first character in the phrase and meets a space.

-Second, you can change how the way you swap from this :

```
  phrase[i] = temp;
  phrase[i] = phrase[j];
  phrase[j] = temp;

```

with this :

```
 temp = phrase[i];
 phrase[i] = phrase[j];
 phrase[j] = temp;

```
This one is pretty easy!

You're on the right track. When you cin your phrase, you can immediately switch the 1st index with the 2nd. Then, you for loop thru the rest. Something like this:
[1]: <https://i.stack.imgur.com/M1ntj.png>