October 21, 2024
Chicago 12, Melborne City, USA
HTML

preg_replace_callback whitespace ignored in menu build


I am dynamically building a menu from .json
I have searched a LOT on this and can’t seem to find a solution.
Everything works fine with the callback – the relevant file called delivers and the content code-build is fine… but, it all ignores white space on the page.

As I say, the code all works fine but… where is the white space? I replaced space with underscore and tried every permutation of 'strtr($data,'_',' ') and likewise with str_replace('_',' ',$data) – single quotes, double – ,in the build code, before the callback, after the callback… tearing a little hair out but, nothing. Also tried various alt codes for space eg. = more hair lost 🙂
Replace the space with ‘x’ and there is an ‘x’ – and why not? But why not a space? I am happy to put up code but I am sure you will likely say: "yes, that works for me…"

I suspect there is something stupidly simple that I am missing and hope you can forgive my current blindness, ignorance. Any suggestions or guidance would be gratefully received. Thank you.



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video