473,322 Members | 1,911 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Backtick call appends extra space

Look at the following code:
<?php
$year = `date +
%Y`;
echo "(".$year.")";
?>

The output is
(2008 )

There is an extra space after the "2008". Why is that, and what can I
do about it?

Mar 31 '08 #1
2 1650
Martin wrote:
There is an extra space after the "2008". [...] what can I
do about it?
use trim(...)

--
http://portal.richler.de/ Namensportal zu Richler
http://www.richler.de/ Heiko Richler: Computer - Know How!
http://www.richler.info/ private Homepage
Mar 31 '08 #2
Martin wrote:
Look at the following code:
<?php
$year = `date +
%Y`;
echo "(".$year.")";
?>

The output is
(2008 )

There is an extra space after the "2008". Why is that, and what can I
do about it?
It's not a space, it's a linefeed (look at the source generated; the
linefeed is converted to a space for presentation because of HTML
whitespace rules). This will happen with pretty much any command line
utility; they all must print a linefeed after their output to get your
prompt on the following line.

And like Heiko Richler said - trim() the output and you shouldn't have
any problems.

Jeremy
Mar 31 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Brian | last post by:
Hello group, http://people.umass.edu/btrembla/ (html 4.01/strict) uses a conventional menu marked up as a list, and css http://people.umass.edu/btrembla/css/brian.css...
0
by: J. Muenchbourg | last post by:
When creating new files for Projects in vs.net, I will get these weird backtick double quotation characters, which will routinely cause errors pointing to the characters when running: ...
0
by: Diane Yocom | last post by:
I'm dynamically building a table in the code behind and I'm having a problem with an extra space after the tablerow. The HTML renders like this: <td> <a href="#"><img src="mypicture1.bmp"...
0
by: David Roche | last post by:
Hello, I searched all through Google Groups, Google, and the Postgres docs, but to no avail. I hope someone can help me out here! I have a file that contains SQL, and some Postgres-specific...
0
by: parez | last post by:
Hi all! The webclient class's uploadvalues method appends %0d%0a to the last value in the name value collection.. Can any one help me out.. Thanks in advance.. Here is code...
5
by: dw | last post by:
hello - first, let me state that i am an Asp.Net rookie. here is the situation: i have a page that looks good in the vs.net designer, but when the page renders there are extra amounts...
34
by: Registered User | last post by:
Hi experts, I'm trying to write a program that replaces two or more consecutive blanks in a string by a single blank. Here's what I did: #include <stdio.h> #include <string.h> #define MAX 80
8
by: dancer | last post by:
Using ASP.net 1.1 to create user input form. When I put a RequiredFieldValidator I have extra space at the bottom of the cell, as if I had put a <br>. When I comment out the...
4
by: Robbie Hatley | last post by:
Some months ago, I'd asked this group: "Backtick, at-sign, dollar-sign: legal in source?" I got 20 replies, most of which were off-topic and did not answer the question. Keith Thompson...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.