How to insert new key value pair inside a multidimensional associative array in PHP

To insert new key value pair inside a multidimensional associative array in PHP
Here am going to explain in details
We have a sample array we need to add Version4 and its value inside the array

$list_array = array( 
            0 => array (
               "Version1" => 2016,
               "Version2" => 2017,	
               "Version3" => 2018
            ),
            
            1 => array (
               "Version1" => 2016,
               "Version2" => 2017,	
               "Version3" => 2018
            )
         );

Here am using for each mange that

 foreach($list_array as $key=>$valuue)
	 {
	  $list[$key]=$listvalue;
	  $list[$key]['Version4']= 2019;
	 }
       print_r($list);

Result

 
array( 
            0 => array (
               "Version1" => 2016,
               "Version2" => 2017,	
               "Version3" => 2018,
               "Version4" => 2019
          
              
            ),
            
            1 => array (
               "Version1" => 2016,
               "Version2" => 2017,	
               "Version3" => 2018,
               "Version4" => 2019
            )
         );

Sample php code for sending OTP

Most of the user oriented website are slowly changing from email and password based login to OTP based login.so for a developer it is necessary to know how to create on OTP based login, here am going to share you Sample PHP code for sending OTP.

First you have to Register with any of the SMS Service providers ,here am using mysmsmantra.Here we are achieving with the help of CURL in PHP,this is the URL API from mysmsmantra for sedning OTP http://bulksms.mysmsmantra.com/WebSMS/SMSAPI.jsp?username=YOUR_USERNAME&password=YOUR_PASSWORD&sendername=rahaul&mobileno=*******&message=your OTP
where YOUR_USERNAME and YOUR_PASSWORD are respectively user name and password from mysmsmantra.

$otp=rand(100000, 999999);
$msg="Dear Customer, One Time Password for activating your account is :".$otp;
$message=urlencode($msg); 
$messageUrl="http://bulksms.mysmsmantra.com/WebSMS/SMSAPI.jsp?username=YOUR_USERNAME&password=YOUR_PASSWORD&sendername=rahaul&mobileno=*******&message=".$message; 
//YOUR_USERNAME and YOUR_PASSWORD are respectively from mysmsmantra
$ch = curl_init($messageUrl); 
$fp = fopen("message.txt", "w+"); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_FILE, $fp); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
curl_exec($ch); curl_close($ch); 

fclose($fp);