9951 explained code solutions for 126 technologies


php-pdoGet current charset with PHP PDO


$charset = $pdo->query("SELECT COLLATION('')")->fetchColumn();ctrl + c
$pdo

PDO connection object

query(

executes specified SQL and return PDOStatement

SELECT COLLATION('')

will return current charset (actually collation, but that's also ok for this task)

$charset

will contain current charset (collation)