Skip to content

Instantly share code, notes, and snippets.

View niravmadariya's full-sized avatar
💭
I may be slow to respond.

Nirav Madariya niravmadariya

💭
I may be slow to respond.
View GitHub Profile
@niravmadariya
niravmadariya / sendmail.php
Last active December 24, 2019 16:28
Send mails using PHPMailer
<?php
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
//Load Composer's autoloader
require 'PHPMailer/autoload.php';
$mail = new PHPMailer(true); // Passing `true` enables exceptions
@niravmadariya
niravmadariya / MySQL-in-app-connection.php
Created November 10, 2018 18:05
MySQL-in-app connection File
<?php
$conn = getenv("MYSQLCONNSTR_localdb"); // this will return the whole connectionstring in a single string
$conarr2 = explode(";",$conn); // Let's beautify it, by splitting it and decorating it in an array
$conarr = array();
foreach($conarr2 as $key=>$value){
$k = substr($value,0,strpos($value,'='));
$conarr[$k] = substr($value,strpos($value,'=')+1);
}
print_r($conarr); // $conarr is an array of values of connection string
?>