Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 68
  • Last Modified:

PHP string issue

I am setting a value but it is being changed. Not sure why.

$field .= '&timestamp_unix=#{timestamp_unix}';

Open in new window


It is outputted as "×tamp_unix=#{timestamp_unix}" instead of "&timestamp_unix=#{timestamp_unix}"

If I put something infront of "time" it is outputted correctly with the text in front. If I use str_replace to try to format it the way I want it reverts to the same issue.
0
Robert Saylor
Asked:
Robert Saylor
  • 3
  • 2
1 Solution
 
Ray PaseurCommented:
&times is the character entity for the little X multiplication sign.  It's working correctly.  Please look at it in the browser's "view source" window and tell us what you see, thanks.
0
 
Robert SaylorSenior DeveloperAuthor Commented:
how can I make "&times" display "&times" instead of "x" ?

I understand the issue now. ASCII ugg
0
 
Ray PaseurCommented:
What does it show in the browser "view source?"

What is the use-case that is in play here?  Is this a template engine for a framework?

This will fix the browser display, but I'm not sure that's what you really want?
https://iconoun.com/demo/temp_robert_saylor.php
<?php // demo/temp_robert_saylor.php
/**
 * https://www.experts-exchange.com/questions/28984771/PHP-string-issue.html
 */
error_reporting(E_ALL);
echo '<pre>';

$field = NULL;
$field .= '&amp;' . 'timestamp_unix=#{timestamp_unix}';
echo $field;

Open in new window

0
 
Robert SaylorSenior DeveloperAuthor Commented:
I will just wrap it in a text box. Was building a configuration system for one of our advertising systems. You identified the ASCII value and that is what was going on. I completely forgot about those. Sadly I thought the ASCII value had to end with the ; but I guess not.
0
 
Robert SaylorSenior DeveloperAuthor Commented:
FYI the wrapper did not work. The &amp; solution did the trick.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now