[Solved] How to get credentials from a String with many characters with substr and store them in variables

Here is a non Regex version of what you are trying to achieve. $str = “server_name::IMACW10\COZMOSQLEXPRESS @database_name::OneTwoThreePet username::pauline_pet databasePass::root”; $test = explode(” “, $str); $array = array(); foreach($test as $key){ $newkey = strtok($key,”:”); $array[$newkey] = substr($key, strpos($key, “:”) + 2); } list($server, $dbname, $username, $pass) = array_values($array); echo ‘$serverName=”.$server.”<br> $databaseName=”.$dbname.”<br> $username=”.$username.”<br> $pass=”.$pass; Output: $serverName=IMACW10\COZMOSQLEXPRESS $databaseName=OneTwoThreePet … Read more

[Solved] How can i access Return value throught the construct() from another function In PHP?

Constructors don’t return values and you can’t just echo an object, try this instead. class some { private $my_string; public function __construct() { $this->my_string = ‘abc’; } public function test() { return $this->my_string; } } $some = new some; echo $some->test(); solved How can i access Return value throught the construct() from another function In … Read more

[Solved] What is the difference between session_id(), session_create_id() and session_regenerate_id() in php?

session_id(): Get and/or set the current session id session_regenerate_id(): Update the current session id with a newly generated one session_create_id(): Create new session id Here is a link to the PHP sessions doc and PHP docs 6 solved What is the difference between session_id(), session_create_id() and session_regenerate_id() in php?