How to access multibyte char from offset 0 in multibyte string? In my PHP file UTF-8 encoding is used.
$month="ř";
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"></head><body>';
die(mb_substr($month,-1,1));
This is the printed output: �
Expected output: ř
I am using PHP 5.4 on my localhost.
Check
mb_internal_encoding()output and/or your ini file. For PHP 5 UTF-8 could not be default value.