Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PHP string issue

Posted on 2016-11-22
5
Medium Priority
?
65 Views
Last Modified: 2016-11-22
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
Comment
Question by:Robert Saylor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 41897742
&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
 

Author Comment

by:Robert Saylor
ID: 41897752
how can I make "&times" display "&times" instead of "x" ?

I understand the issue now. ASCII ugg
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 41897764
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
 

Author Closing Comment

by:Robert Saylor
ID: 41897874
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
 

Author Comment

by:Robert Saylor
ID: 41897883
FYI the wrapper did not work. The &amp; solution did the trick.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question