The following gives an error:
<?php
$super-man=100;
?>
Parse error: parse error, unexpected '=' in /test.php on line 2
I understand that the "-" sign is seen as an operator.
is there a way to get around this? I need to have "-" in variable names.
Thanks,
Ross 12 12115
ross wrote: The following gives an error:
<?php $super-man=100; ?>
Parse error: parse error, unexpected '=' in /test.php on line 2
I understand that the "-" sign is seen as an operator. is there a way to get around this? I need to have "-" in variable names.
No, you cannot use the "-" sign in variables. You can use "_".
Cheers,
Nicholas Sherlock
ross wrote: The following gives an error:
<?php $super-man=100; ?>
Parse error: parse error, unexpected '=' in /test.php on line 2
I understand that the "-" sign is seen as an operator.
Correct, the "-" sign is considered as a minus sign.
is there a way to get around this? I need to have "-" in variable names.
Why?
You can safely use "_" (underscore) instead. If you need to use it in a
query string or form field, use $_POST, $_GET or $_REQUEST.
--
Kim André Akerĝ
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Kim André Akerĝ wrote: ross wrote:
The following gives an error:
<?php $super-man=100; ?>
Parse error: parse error, unexpected '=' in /test.php on line 2
I understand that the "-" sign is seen as an operator.
Correct, the "-" sign is considered as a minus sign.
is there a way to get around this? I need to have "-" in variable names.
Why?
You can safely use "_" (underscore) instead. If you need to use it in a query string or form field, use $_POST, $_GET or $_REQUEST.
- characters in those arrays are replaced by _ automagically...
--
Justin Koivisto, ZCE - ju****@koivi.com http://koivi.com
Justin Koivisto wrote: Kim André Akerĝ wrote: ross wrote:
The following gives an error:
<?php $super-man=100; ?>
Parse error: parse error, unexpected '=' in /test.php on line 2
I understand that the "-" sign is seen as an operator.
Correct, the "-" sign is considered as a minus sign.
is there a way to get around this? I need to have "-" in variable names.
Why?
You can safely use "_" (underscore) instead. If you need to use it in a query string or form field, use $_POST, $_GET or $_REQUEST.
- characters in those arrays are replaced by _ automagically...
I wasn't aware of that. Then again, I've never had the need/use to have
a "-" in a variable (either in a form or as a query string).
--
Kim André Akerĝ
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
On Fri, 09 Dec 2005 14:20:25 -0500, ross <ao*******@yahoo.com> wrote: I understand that the "-" sign is seen as an operator. is there a way to get around this? I need to have "-" in variable names.
Why do you need to have "-" in variable names?!?
(answering this question might help us find you an alternative)
ross wrote: The following gives an error:
<?php $super-man=100; ?>
Parse error: parse error, unexpected '=' in /test.php on line 2
I understand that the "-" sign is seen as an operator. is there a way to get around this? I need to have "-" in variable names.
Why? No one else does.
Ian
Justin Koivisto (ju****@koivi.com) wrote:
: Kim André Akerĝ wrote:
: >
: > You can safely use "_" (underscore) instead. If you need to use it in a
: > query string or form field, use $_POST, $_GET or $_REQUEST.
: - characters in those arrays are replaced by _ automagically...
There must be a config setting to do that, cause I have never observed
that behaviour. The following uses - in the html parameter names.
<?php
echo "the-name = [";
echo $_REQUEST['the-name'];
echo "]\n";
echo "hidden-name = [";
echo $_REQUEST['hidden-name'];
echo "]\n";
?>
<form>
<input type="text" name="the-name" />
<input type="hidden" name="hidden-name" value="a hidden value" />
<input type=submit />
</form>
Malcolm Dew-Jones wrote: Justin Koivisto (ju****@koivi.com) wrote:
: Kim André Akerĝ wrote: : > : > You can safely use "_" (underscore) instead. If you need to use it in a : > query string or form field, use $_POST, $_GET or $_REQUEST.
: - characters in those arrays are replaced by _ automagically...
There must be a config setting to do that, cause I have never observed that behaviour. The following uses - in the html parameter names.
<?php
echo "the-name = ["; echo $_REQUEST['the-name']; echo "]\n";
echo "hidden-name = ["; echo $_REQUEST['hidden-name']; echo "]\n";
?>
<form>
<input type="text" name="the-name" />
<input type="hidden" name="hidden-name" value="a hidden value" />
<input type=submit />
</form>
Now I wonder if I have that mixed up with something else dealing with
hyphens in the field names of posted forms... (PDF forms perhaps?)
I know it came up once in a script I was debugging a couple years ago,
so maybe it was something from a previous version, or maybe it was if
register_globals = 1
--
Justin Koivisto, ZCE - ju****@koivi.com http://koivi.com
Malcolm Dew-Jones wrote: Justin Koivisto (ju****@koivi.com) wrote:
: Kim André Akerĝ wrote: : > : > You can safely use "_" (underscore) instead. If you need to use it ina : > query string or form field, use $_POST, $_GET or $_REQUEST.
: - characters in those arrays are replaced by _ automagically...
There must be a config setting to do that, cause I have never observed that behaviour. The following uses - in the html parameter names.
I would have sworn to god that that's how it work, at least in the case
of register_globals = 1 and extract(). Yet that's not the behavior when
I tried. Dashes remain dashes in $_GET and the variable isn't set.
Weird...
Chung Leong wrote: Malcolm Dew-Jones wrote:
Justin Koivisto (ju****@koivi.com) wrote:
: Kim André Akerĝ wrote: : > : > You can safely use "_" (underscore) instead. If you need to use it in a : > query string or form field, use $_POST, $_GET or $_REQUEST.
: - characters in those arrays are replaced by _ automagically...
There must be a config setting to do that, cause I have never observed that behaviour. The following uses - in the html parameter names.
I would have sworn to god that that's how it work, at least in the case of register_globals = 1 and extract(). Yet that's not the behavior when I tried. Dashes remain dashes in $_GET and the variable isn't set. Weird...
Good, I'm not completely loosing it them... ;)
--
Justin Koivisto, ZCE - ju****@koivi.com http://koivi.com
Justin Koivisto wrote: Chung Leong wrote: Malcolm Dew-Jones wrote:
Justin Koivisto (ju****@koivi.com) wrote:
: Kim André Akerĝ wrote: : > : > You can safely use "_" (underscore) instead. If you need to use it in a : > query string or form field, use $_POST, $_GET or $_REQUEST.
: - characters in those arrays are replaced by _ automagically...
There must be a config setting to do that, cause I have never observed that behaviour. The following uses - in the html parameter names.
I would have sworn to god that that's how it work, at least in the case of register_globals = 1 and extract(). Yet that's not the behavior when I tried. Dashes remain dashes in $_GET and the variable isn't set. Weird...
Good, I'm not completely loosing it them... ;)
-- Justin Koivisto, ZCE - ju****@koivi.com http://koivi.com
Aha, now I remember! It's the period/fullstop that gets automatically
replaced by an underscore, not the dash.
I "was" parsing a xml file and would like to create variables on the fly
with the same name as the XML tags. some of the xml tags are in the
form "xx-yy" etc.
I now know the xml structure and I am reverting back to xx_yy. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Yasutaka Ito |
last post by:
Hi folks!
I have a BaseForm class that inherits System.Windows.Forms.Form. It has a
property, whose value I need supplied by the class that inherits it. The
BaseForm usees the value supplied...
|
by: Bob |
last post by:
I am displaying a form with a datagrid populated from a select of database
records which now exceed 12,000 when I select them all.
The form displays just fine with all 12,000+ entries but when I...
|
by: Bob |
last post by:
I am displaying a form with a datagrid populated from a select of database
records which now exceed 12,000 when I select them all.
The form displays just fine with all 12,000+ entries but when I...
|
by: Peter |
last post by:
I've purchased VS.NET 2005 Standard and have tried to install SQL Server
2005 Express, but get the following error in the error log.
Please could someone help me....
Microsoft SQL Server 2005...
|
by: ThunderMusic |
last post by:
Hi,
I have a custom form that works fine when I debug it or run it in release
mode but cannot be loaded in the designer... Actually, it can be loaded in
the designer when no control is on it, but...
| |
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= |
last post by:
Hello, mister
I have an application web asp.net 2.0 + vs 2005 and VS 2005 Web Application
Project.
Its appears this error in execution:
"Cannot Create/Shadow Copy '<projectname>' when that...
|
by: amanjsingh |
last post by:
Hi, I am trying to implement Java Web Service using Apache Axis2 and Eclipse as a tool. I have created the basic code and deployed the service using various eclipse plugin but when I try to invoke...
|
by: karinmorena |
last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is:
Week5MortgageGUI.java:151:cannot find symbol
symbol: method allInterest(double,double,double)...
|
by: kw.housing |
last post by:
I have all the library already in path:
$ ls -l /opt/IBM/db2/lib64 | grep libdb2o
-r-xr-xr-x 1 bin bin 7757295 Jul 12 2006 libdb2osse.a*
-r--r--r-- 1 bin bin ...
|
by: Sindhu Rani |
last post by:
i hav created 3 classes in 3 different files. am gettin an error durin compilation. wat shud i do???
C:\s\source>javac -d ..\classes devtestdrive.java
devtestdrive.java:5: cannot resolve symbol...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |