Created
November 10, 2018 18:05
-
-
Save niravmadariya/87e2a3c540401e3ef02a821a0f1face2 to your computer and use it in GitHub Desktop.
MySQL-in-app connection File
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment