title: How do I pass a variable as an array separated by comma?
body: <p>A user enters two date periods on a text box and a message to be sent. I get the values as $time1 and $time2 and $message respectively. I use $time1 and $time2 in a select statement which should fetch the mobile numbers in the database between the two times. These are the numbers to receive the message. </p>
  
  <p>Question, how do I save these numbers into one variable assuming they were ten numbers which I should pass to a web service to receive the message. The numbers also need to be separated by a comma to differentiate them. For separation, I think implode function would work in array. 
  I am new in PHP so someone help me achieve this.  Thank you.</p>
  
  <pre><code>$message =mysqli_real_escape_string($conn, $_POST['message']);
  $time1 = mysqli_real_escape_string($conn, $t1);
  $time2 = mysqli_real_escape_string($conn, $t2);
  
  $sql =  "SELECT DISTINCT msisdn FROM customer WHERE DATE_FORMAT(time_paid, '%Y-%c-%e') BETWEEN ADDDATE('$time1',INTERVAL 0 HOUR) AND ADDDATE('$time2',INTERVAL '23:59' HOUR_MINUTE)";
  $result = $conn-&gt;query($sql);
  
  if ($result-&gt;num_rows &gt; 0) 
  {
       //Output data of each row
      while($row = $result-&gt;fetch_assoc()) 
      {
      $mobilenumber = $row['msisdn'];
      }
  } 
  else 
  {
    echo "No data in the server! ";
  }
  $conn-&gt;close();
  
  sendbulk($mobilenumber, $message);
  
  function sendbulk($mobilenumber, $message) 
  {
  
      $serviceArguments = array(
          "mobilenumber" =&gt; $mobilenumber,
          "message" =&gt; $message
      );
  
     $client = new SoapClient("http://*****:8080/WebSms/smswebservice?wsdl");
  
      $result = $client-&gt;process($serviceArguments);
  
      return $result;
  }
  </code></pre>