.htaccess Redirect all request to index file

Redirect all request to index.php using .htaccess file. 

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php?$1 [L]

URI value after root folder will be set as SCRIPT_URI OR QUERY_STRING.

Tags: Rewrite, Htaccess

PHP implode multi-dimensional array to string

Convert multi-dimensional srray to string.

$source_array = { [A] => ( [0] => "Apple", [1] => "Banana"), [B] => ( [0] => "Tiger", [1] => "Lion")}

echo implode(',', array_map(function($el){ return $el['1']; }, $source_array));

Output:  "Banana", "Lion"


Tags: Php, Php-array, String