note 95942 modified in function.urldecode by danbrown

From: Date: Fri, 29 Jan 2010 19:05:01 +0000
Subject: note 95942 modified in function.urldecode by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-165501@lists.php.net to get a copy of this message
I was looking for a fast way to build a string dsn from a key => value pair array. I came up with the following, simple enough for my purposes. <?php $dsn = Array( 'host' => 'localhost', 'port' => 80, 'user' => 'foo', 'pass' => 'R(I%!JAKSJ(asd' ); $dsn = urldecode(http_build_query($dsn, NULL, ';')); var_dump($dsn); // host=localhost;port=80;user=foo;pass=R(I%!JAKSJ(asd ?> --was-- I was looking for a fast way to build a string dsn from a key => value pair array. I came up with the following, simple enough for my purposes. <?php $dsn = Array( 'host' => 'localhost', 'port' => 80, 'user' => 'foo', 'pass' => 'R(I%!JAKSJ(asd' ); $dsn = urldecode(http_build_query($dsn, NULL, ';')); var_dump($dsn); // host=localhost;port=80;user=foo;pass=R(I%!JAKSJ(asd http://php.net/manual/en/function.urldecode.php

« previous php.notes (#165501) next »