<?php
// n-dashes are encoded as byte sequence \xe2\x80\x93 in UTF-8
$str = 'foo–bar–baz';
// take substring of 4 bytes length starting with the 4th byte
var_dump(mb_strcut($str, 4, 4, 'UTF-8'));
// take substring of 4 code points length starting with the 4th code point
var_dump(mb_substr($str, 4, 4, 'UTF-8'));
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
string(4) "–b"
string(6) "bar–"