-2

How can I make var_dump like output from an array that manages string characters length well, that is the same counts with and without accents?

/var/www/test.php:4:
array (size=2)
  0 => string 'qwertzuiop' (length=10)
  1 => string 'qwértzúíóp' (length=14)
  • Did you actually *try anything*? Start with a loop... and then try to make something that matches what you are looking for. – IncredibleHat Mar 13 '18 at 13:27

1 Answers1

2

See mb_strlen(): http://php.net/manual/en/function.mb-strlen.php

This should return a length of 10 for 'qwértzúíóp'.

var_dump() will always return a length of 14 bytes for 'qwértzúíóp' because that is the actual size.

KIKO Software
  • 15,283
  • 3
  • 18
  • 33
  • That's fine, but I do not need to be value, but must be a formatted output. Like var_dump: key, value, length and formatted for multi-level arrays. – Zoltán Németh Mar 13 '18 at 13:12
  • Have you looked for `dump_var()` alternatives? See: https://www.leaseweb.com/labs/2013/10/smart-alternative-phps-var_dump-function There are many. – KIKO Software Mar 13 '18 at 13:13