Author Topic: PHP doesn't understand numbers  (Read 228 times)

UbuntuWarrior

  • New Member
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
PHP doesn't understand numbers
« on: August 21, 2010, 09:50:32 PM »
Hi, I'm new here, but not so new to PHP (but still a beginner in a way).

I installed LAMP today on Ubuntu 10.04 and I've installed LAMP before, but this installation is a little weird. Everything works properly, but if I was to echo a number, nothing would happen.

Is anyone familiar with this problem and know how to fix it?

Thanks in advance!

UbuntuWarrior

  • New Member
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: PHP doesn't understand numbers
« Reply #1 on: August 23, 2010, 02:44:05 PM »
Sorry for double posting, but if I was to do something like this:

Code: [Select]
<?php echo "My favorite number is 23"?>
This would output: "My favorite number is"

I've never experienced this type of problem before on any other server.

Smokey PHP

  • Web Developer
  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 506
  • Karma: +4/-0
    • View Profile
Re: PHP doesn't understand numbers
« Reply #2 on: September 08, 2010, 04:49:27 PM »
Apologies in advance for the useless post, but... I have never come across that problem before!

Make sure that this is not being hidden because it's in a fixed-width element or anything like that. You could also try using ' instead of " and see if that makes a difference. Another (very strange) test is to assign that number to a variable - i.e.

PHP Code: [Select]

<?php
$num 
23;
echo 
"my favourite number is ".$num;
?>


Let me know how you get on with this - I am very intrigued.