PHP is not parsing correctly, cut & paste

Problems with the Windows version of XAMPP, questions, comments, and anything related.

PHP is not parsing correctly, cut & paste

Postby Kyp » 22. March 2012 05:24

I've redefined the problem, please see my notes below

I'm running Apache 1.77, PHP 5.3.8 and obtain parsing errors on the simplest of variable assignments.

Code: Select all
$quantity = 30;
$price = 119.95;
$taxrate = .05;


results in:

Parse error: syntax error, unexpected T_DNUMBER in C:\xampp\htdocs\myphp\NumbersClip.php on line 3

Ok, perhaps someone can explain this to me:
The code not working is a cut and paste, not just here but into my php file. However, if I type the code into my notepad++ directly and run it then it works. I've even tried to run after saving in a 'cut and paste' to a windows notebook and I get parsing errors. I've tried cut 'n' paste of different code from different sources and get parsing errors, also on assignment variables. Anyone else had such problems ? I've even highlighted the code to look for training spaces, but find none.
Last edited by Kyp on 28. March 2012 01:59, edited 2 times in total.
Posts: 2
Joined: 22. March 2012 04:54
Operating System: Windows Vista

Re: New Install and PHP is not parsing correctly

Postby hackattack142 » 23. March 2012 01:46

I don't write PHP but I am going to take a guess and say a number should always start with a number. A period is not a number so you could try putting $taxrate = 0.05;
XAMPP Control Panel Developer
Latest CP: viewtopic.php?f=16&t=48932
Posts: 703
Joined: 20. May 2011 23:29
Operating System: Windows 7 Ultimate SP1 64-Bit

Re: New Install and PHP is not parsing correctly

Postby Altrea » 23. March 2012 06:25

The full expression for a double value in php is wrote:
Code: Select all
([0-9]*[\.][0-9]+) | ([0-9]+[\.][0-9]*)

so, there can be a leading zero, but it don't have to (presuming there are coming digits after the dot).
By now i have no idea why this error occurs on your machine.

I will try to do some Bugtracking on different machines.

best wishes,
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
AF Moderator
Posts: 9441
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Cut and Paste to PHP not parsing

Postby Kyp » 28. March 2012 01:56

I posted the problem here:

and received a few replys before I realized that the problem needed to be redefined. Apparantly when I type my code directly, I have no parsing errors. However, a cut & paste of correct code is not being parsed. I am using Notepad++, encoded in ANSI for php code editing.
Last edited by Sharley on 28. March 2012 02:01, edited 1 time in total.
Reason: Related posts so new topic not required.
Posts: 2
Joined: 22. March 2012 04:54
Operating System: Windows Vista

Re: PHP is not parsing correctly, cut & paste

Postby Sharley » 28. March 2012 02:04

To eliminate a Notepad++ issue try using Windows Notepad and see if you still have this copy and paste issue.

If Notepad works then it has to be either a setting (perhaps BOM) in Notepad++ or...

...where are you copying the code from as there may be hidden formatting code tags that are also being copied, usually if you copy from a web page this can occur.

Best to use the web page source code view to see what you are actually copying.
User avatar
AF Moderator
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 72 guests