1

With phpdocx, I am retrieving a template variable from a *.docx file. However, when var_dump()-ing the string, I receive:

 string(46) "Name(/)Frage(/)rad:Ja(=>ja),Nein(=>nein)"

Obviously, the string's length is 40. How can I see, what else is stored in the string?

I think the ">" are the problem. They are being converted to > I think. Can I stop this behaviour?

Many thanks and best, Philip

phpcrack
  • 63
  • 5
  • Have you tried [splitting](https://www.php.net/manual/en/function.mb-str-split) it and dumping the result? – El_Vanja Mar 16 '21 at 15:55
  • Splitting by what exactly? – phpcrack Mar 16 '21 at 16:12
  • @El_Vanja I think the implication is that there are some invisible characters – ADyson Mar 16 '21 at 16:13
  • @ADyson Can I make them visible? – phpcrack Mar 16 '21 at 16:18
  • I think the ">" are the problem. They are being converted to > I think. Can I stop this behaviour? – phpcrack Mar 16 '21 at 16:25
  • 2
    You should not look and copy+paste the string from your browser's HTML display. Always check the output in page source or from command line. (If you must, you could add `htmlspecialchars()`). To answer your question: You can foreach the string and print out each character value with `ord()` or `mb_ord()`. – steffen Mar 16 '21 at 16:32
  • @steffen how can I check it in the command line? I think the problems are the two ">". Such are converted to >. Can I stop this behaviour? – phpcrack Mar 16 '21 at 16:36
  • 1
    @phpcrack I don't know how you run PHP on CLI because I don't know your setup. Alternatively, just check the HTML source output (right click, view page source). These special HTML characters are apparently converted by phpdocx and that seems to me like reasonable behaviour if the target format is HTML. – steffen Mar 16 '21 at 17:05
  • @phpcrack When you run your PHP script from the command line, you will (usually) not get any replacements like `<` to `<`. Please [edit] your question to include the source code as a [mcve], show exactly how you execute it from the command line and the output you get. – Progman Mar 16 '21 at 19:12

0 Answers0