
October 6th, 2008, 10:55 PM
| | | arrays, constants, booleans, arithmetic values
define('P_START_YES', 1, FALSE);
define('P_START_NO', 0, FALSE);
define('P_END_YES', 2, FALSE);
define('P_END_NO', 0, FALSE);
define('APPEND_NL', 4, FALSE);
$aMenus = array(
array(0, 'http://www.example.com/', 'Example 001', P_START_YES || P_END_YES || APPEND_NL),
array(1, 'http://www.example.net/', 'Example 002', P_START_YES || P_END_YES || APPEND_NL)
);
I tried enclosing those values above (P_START_YES, et al) in parenthesis
but PHP complains that it expects a terminating parenthesis. I think this
may be a problem with the latest version of PHP. Why can't I put those
CONSTANTS in parenthesis and use the OR, or | or || to create values?
I was hoping to combine that into one value, rather than use three
separate fields to hold the values. And it seems strange that I'd need
to do like this...
$iTags = P_START_YES || P_END_YES || APPEND_NL;
// blah... I do not see the means at the moment, it's not in a foreach() loop.
--
Jim Carlock
You Have More Than Five Senses http://www.associatedcontent.com/art...ve_senses.html | 
October 6th, 2008, 11:05 PM
| | | Re: arrays, constants, booleans, arithmetic values
..oO(Jim Carlock) Quote:
>define('P_START_YES', 1, FALSE);
>define('P_START_NO', 0, FALSE);
>define('P_END_YES', 2, FALSE);
>define('P_END_NO', 0, FALSE);
>define('APPEND_NL', 4, FALSE);
>
>$aMenus = array(
>array(0, 'http://www.example.com/', 'Example 001', P_START_YES || P_END_YES || APPEND_NL),
>array(1, 'http://www.example.net/', 'Example 002', P_START_YES || P_END_YES || APPEND_NL)
>);
>
>I tried enclosing those values above (P_START_YES, et al) in parenthesis
>but PHP complains that it expects a terminating parenthesis.
| Works here (5.2.6), but the operator should be |, not ||.
Micha | 
October 6th, 2008, 11:55 PM
| | | Re: arrays, constants, booleans, arithmetic values
"Michael Fesser" wrote...
: Works here (5.2.6), but the operator should be |, not ||.
I tried |, || and OR. Must be something else. Thanks. I'll dig a little
deeper and see if I can spot it.
--
Jim Carlock
You Have More Than Five Senses http://www.associatedcontent.com/art...ve_senses.html | 
October 7th, 2008, 12:05 AM
| | | Re: arrays, constants, booleans, arithmetic values
"Michael Fesser" wrote...
: Works here (5.2.6), but the operator should be |, not ||.
What about inside a class...
<?php
define('P_START_YES', 1, FALSE);
define('P_START_NO', 0, FALSE);
define('P_END_YES', 2, FALSE);
define('P_END_NO', 0, FALSE);
define('APPEND_NL', 4, FALSE);
class cMenus {
private $aMenus = array(
array(0, 'http://www.example.com/', 'Example 001', P_START_YES | P_END_YES | APPEND_NL),
array(1, 'http://www.example.net/', 'Example 002', P_START_YES | P_END_YES | APPEND_NL)
);
}
?>
I must be overlooking something big time, if that works.
--
Jim Carlock
You Have More Than Five Senses http://www.associatedcontent.com/art...ve_senses.html | 
October 7th, 2008, 02:15 AM
| | | Re: arrays, constants, booleans, arithmetic values
Jim Carlock wrote: Quote:
"Michael Fesser" wrote...
: Works here (5.2.6), but the operator should be |, not ||.
>
What about inside a class...
>
<?php
define('P_START_YES', 1, FALSE);
define('P_START_NO', 0, FALSE);
define('P_END_YES', 2, FALSE);
define('P_END_NO', 0, FALSE);
define('APPEND_NL', 4, FALSE);
>
class cMenus {
>
private $aMenus = array(
array(0, 'http://www.example.com/', 'Example 001', P_START_YES | P_END_YES | APPEND_NL),
array(1, 'http://www.example.net/', 'Example 002', P_START_YES | P_END_YES | APPEND_NL)
);
>
}
?>
>
I must be overlooking something big time, if that works.
>
| This is completely different than your first post. Initializing
variables in a class must use constants - no variables or operators are
allowed.
If you need this, put it in the constructor.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attglobal.net
================== | 
October 7th, 2008, 02:55 AM
| | | Re: arrays, constants, booleans, arithmetic values
"Jerry Stuckle" wrote...
: This is completely different than your first post. Initializing variables
: in a class must use constants - no variables or operators are allowed.
:
: If you need this, put it in the constructor.
:
Thanks. I kept thinking I left out a parenthesis or quotation mark. That
fixed it. The error message threw me off.
[06-Oct-2008 19:36:30] PHP Parse error: syntax error, unexpected '|', expecting ')'
Yeah, I did not realize the class made a difference like that. I thrive
off the procedural speed and the low memory use/requirements.
Thanks, Jerry. Thanks, Micha.
--
Jim Carlock
You Have More Than Five Senses http://www.associatedcontent.com/art...ve_senses.html
Ralph Nader Is Running! http://www.votenader.org/ |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | |