php-general Digest 1 May 2007 08:10:54 -0000 Issue 4766
Topics (messages 254151 through 254179):
Re: What does "<<<" mean?
254151 by: Greg Donald
254152 by: Daniel Brown
254153 by: Micky Hulse
254154 by: Daniel Brown
254155 by: Micky Hulse
254156 by: Daniel Brown
254164 by: Philip Thompson
254165 by: Greg Donald
254166 by: Daevid Vincent
254167 by: Greg Donald
254168 by: Brian Seymour
254169 by: Paul Novitski
254170 by: Richard Davey
254171 by: Greg Donald
254172 by: Greg Donald
254173 by: Robert Cummings
254174 by: Micky Hulse
254177 by: Larry Garfield
newbie needs help
254157 by: Ben Clapp
254158 by: Daniel Brown
254159 by: Richard Davey
254160 by: Daniel Brown
254161 by: Ben Clapp
254162 by: Richard Davey
254163 by: Daniel Brown
Re: sloppy use of constants as strings. WAS: What does "<<<" mean?
254175 by: Daevid Vincent
254176 by: Chris
254179 by: Robin Vickery
session id nightmare
254178 by: Brad Sumrall
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
On 4/30/07, Nick Gorbikoff <[EMAIL PROTECTED]> wrote:
Hello, folks.
I rember I've since this somewhere in perl and it has somethign to do with
blocks of code. I came across the same thing in some PHP code.
<<< END
....some code....
END
What exactly does it mean.
BTW:
PHP .net search breaks if you search for <<<
It's heredoc syntax.
http://us2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
--
Greg Donald
http://destiney.com/
--- End Message ---
--- Begin Message ---
It means to read until it reaches the matching expression --- in this
case, END.
On 4/30/07, Nick Gorbikoff <[EMAIL PROTECTED]> wrote:
Hello, folks.
I rember I've since this somewhere in perl and it has somethign to do with
blocks of code. I came across the same thing in some PHP code.
<<< END
....some code....
END
What exactly does it mean.
BTW:
PHP .net search breaks if you search for <<<
Regards,
------------------------------------------------------
Nick
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
--- End Message ---
--- Begin Message ---
Hi Daniel,
Daniel Brown wrote:
BTW:
PHP .net search breaks if you search for <<<
Try this:
www.php.net/<<<
And then scroll down to heredoc section.
Heredoc comes in handy from time-to-time.
Cheers,
M
--
Wishlists: <http://snipurl.com/1gqpj>
Switch: <http://browsehappy.com/>
BCC?: <http://snipurl.com/w6f8>
My: <http://del.icio.us/mhulse>
--- End Message ---
--- Begin Message ---
Actually, that should be directed at the OP who said that. I was able
to bring up the heredoc, too. ;-P
On 4/30/07, Micky Hulse <[EMAIL PROTECTED]> wrote:
Hi Daniel,
Daniel Brown wrote:
>> BTW:
>> PHP .net search breaks if you search for <<<
Try this:
www.php.net/<<<
And then scroll down to heredoc section.
Heredoc comes in handy from time-to-time.
Cheers,
M
--
Wishlists: <http://snipurl.com/1gqpj>
Switch: <http://browsehappy.com/>
BCC?: <http://snipurl.com/w6f8>
My: <http://del.icio.us/mhulse>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
--- End Message ---
--- Begin Message ---
Daniel Brown wrote:
Actually, that should be directed at the OP who said that. I was able
to bring up the heredoc, too. ;-P
Ooops! Sorry Daniel, I meant to reply to Nick... My mistake. :(
--
Wishlists: <http://snipurl.com/1gqpj>
Switch: <http://browsehappy.com/>
BCC?: <http://snipurl.com/w6f8>
My: <http://del.icio.us/mhulse>
--- End Message ---
--- Begin Message ---
No need to apologize at all, Micky!
On 4/30/07, Micky Hulse <[EMAIL PROTECTED]> wrote:
Daniel Brown wrote:
> Actually, that should be directed at the OP who said that. I was
able
> to bring up the heredoc, too. ;-P
Ooops! Sorry Daniel, I meant to reply to Nick... My mistake. :(
--
Wishlists: <http://snipurl.com/1gqpj>
Switch: <http://browsehappy.com/>
BCC?: <http://snipurl.com/w6f8>
My: <http://del.icio.us/mhulse>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
--- End Message ---
--- Begin Message ---
On Apr 30, 2007, at 2:17 PM, Greg Donald wrote:
On 4/30/07, Nick Gorbikoff <[EMAIL PROTECTED]> wrote:
Hello, folks.
I rember I've since this somewhere in perl and it has somethign to
do with
blocks of code. I came across the same thing in some PHP code.
<<< END
....some code....
END
What exactly does it mean.
BTW:
PHP .net search breaks if you search for <<<
It's heredoc syntax.
http://us2.php.net/manual/en/
language.types.string.php#language.types.string.syntax.heredoc
Ok, let's gather some stats to see how many people actually use the
heredoc syntax. I created this quick little form to gather the data.
It's takes 2 seconds (literally) - vote here:
http://thril.uark.edu/heredoc/
I'm interested in knowing if this is used a lot. If it is, then I may
consider tying it into my code (if it calls for it).
~Philip
--- End Message ---
--- Begin Message ---
On 4/30/07, Philip Thompson <[EMAIL PROTECTED]> wrote:
Ok, let's gather some stats to see how many people actually use the
heredoc syntax. I created this quick little form to gather the data.
It's takes 2 seconds (literally) - vote here:
http://thril.uark.edu/heredoc/
If you're not using it you're working yourself way too hard.
echo "=== UPLOAD FILE ===\n";
echo "CLIENT: " . $_SERVER['REMOTE_ADDR'] . "\n";
echo "BROWSER: " . $_SERVER['HTTP_USER_AGENT'] . "\n";
echo "TIME: " . date("Y-m-d H:i:s") . "\n";
echo "ENCODED: $encoded\n";
echo "UID: $uid\n";
echo "PATH: $path\n";
echo "EMAIL: $email\n";
echo "PROJECT: $prj\n";
echo "LENGTH: " . $_SERVER['CONTENT_LENGTH'] . "\n";
echo "\n";
Versus:
$date = date( 'Y-m-d H:i:s' );
echo <<<EOF
=== UPLOAD FILE ===
CLIENT: $_SERVER[REMOTE_ADDR]
BROWSER: $_SERVER[HTTP_USER_AGENT]
TIME: $date
ENCODED: $encoded
UID: $uid
PATH: $path
EMAIL: $email
PROJECT: $prj
LENGTH: $_SERVER[CONTENT_LENGTH]
EOF;
--
Greg Donald
http://destiney.com/
--- End Message ---
--- Begin Message ---
> echo "BROWSER: " . $_SERVER['HTTP_USER_AGENT'] . "\n";
I've always had problems with heredoc when I try using arrays like that. I
will either pull them into a straight $foo, or use the ${} thing.
> echo <<<EOF
> BROWSER: $_SERVER[HTTP_USER_AGENT]
> EOF;
Isn't that form (sans quote marks) deprecated and frowned upon?
--- End Message ---
--- Begin Message ---
On 4/30/07, Daevid Vincent <[EMAIL PROTECTED]> wrote:
> echo <<<EOF
> BROWSER: $_SERVER[HTTP_USER_AGENT]
> EOF;
Isn't that form (sans quote marks) deprecated and frowned upon?
<?php
error_reporting( E_ALL );
echo <<<EOF
BROWSER: $_SERVER[HTTP_USER_AGENT]
EOF;
Why would cleaner, perfectly error free code be frowned upon?
--
Greg Donald
http://destiney.com/
--- End Message ---
--- Begin Message ---
Heredoc is truly a great thing. You'll learn to love heredoc whenever you
have tons of stuff you need to print instead of escaping php. A great
example is output that comes from classes, where you can't break the class
into multiple code blocks. Just don't forget that heredoc end part has to be
on the very next line with no whitespace to start. Confusing at times.
Cheers!
-BRIAN
>Ok, let's gather some stats to see how many people actually use the
>heredoc syntax. I created this quick little form to gather the data.
>It's takes 2 seconds (literally) - vote here:
>http://thril.uark.edu/heredoc/
>I'm interested in knowing if this is used a lot. If it is, then I may
>consider tying it into my code (if it calls for it).
>~Philip
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
At 4/30/2007 03:38 PM, Philip Thompson wrote:
Ok, let's gather some stats to see how many people actually use the
heredoc syntax. I created this quick little form to gather the data.
It's takes 2 seconds (literally) - vote here:
http://thril.uark.edu/heredoc/
I'm interested in knowing if this is used a lot. If it is, then I may
consider tying it into my code (if it calls for it).
I recommend that you to make your decision about using heredoc based
on whether the syntax itself makes good sense to you, not based on
which number or percentage of other programmers use it.
I love using heredoc and I don't give a rat's ass if there are only
three other people in the world who use it. It absolutely makes
sense to me, helps me write better code with fewer errors and that's
much easier to read. I know from previous discussions of this topic
that it gives some people the freakin' heebee-jeebies. That's fine;
different strokes; doesn't matter. It's just one tool.
I use heredoc mostly for SQL queries, for html blocks, for inline
html assembly, and for other circumstances in which I'm merging
literals & variables. If a statement gets messy with too many
concatenations, I'll use heredoc. I use heredoc for much the same
reasons I like to separate data from logic in separate files. The
next best thing to importing text is to heredoc it in the script
itself. Also heredoc can be a quick & dirty way of roughing out a
script to get the logic right before exporting the text to a separate file.
Another commenter in this thread is correct: you can't get away with
referring to an array variable in heredoc without using {curly
braces} e.g. {$aArray['key']}. That and the fact that the
termination symbol has to be at the left margin are minor
disadvantages in my view, far outweighed by the difficulty in
accurately writing and reading complex concatenations.
When I first started using PHP I thought that each heredoc label had
to be unique. Turns out that's not true, and now I use the simple shorthand:
$sResult = <<<_
Some text.
_;
Regards,
Paul
__________________________
Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com
--- End Message ---
--- Begin Message ---
Greg Donald wrote:
On 4/30/07, Daevid Vincent <[EMAIL PROTECTED]> wrote:
> echo <<<EOF
> BROWSER: $_SERVER[HTTP_USER_AGENT]
> EOF;
Isn't that form (sans quote marks) deprecated and frowned upon?
<?php
error_reporting( E_ALL );
echo <<<EOF
BROWSER: $_SERVER[HTTP_USER_AGENT]
EOF;
Why would cleaner, perfectly error free code be frowned upon?
I'm not dissing heredoc syntax, it has its uses (now and again) but it's
far from "clean", especially when embedded deep in classes - the major
cause being the delimeters insistance on being at the very start of the
line. It's just *not* pretty IMHO. Certainly not girl code [1]
The frowning surely would be at the mixing of logic and presentation,
regardless how that mix happens (heredoc, echo, jumping in and out of
PHP tags, sprintf, etc).
Cheers,
Rich
[1]
http://headrush.typepad.com/creating_passionate_users/2006/03/code_like_a_gir.html
--
Zend Certified Engineer
http://www.corephp.co.uk
"Never trust a computer you can't throw out of a window"
--- End Message ---
--- Begin Message ---
On 4/30/07, Richard Davey <[EMAIL PROTECTED]> wrote:
I'm not dissing heredoc syntax, it has its uses (now and again) but it's
far from "clean", especially when embedded deep in classes
Classes? PHP is the absolute worst language to do OO programming in.
If you like OO, move on to ruby or python, you'll be much happier. Or
you can wait around until PHP fully (d)evolves into Java.
the major
cause being the delimeters insistance on being at the very start of the
line.
All parts of a heredoc statement do not have to be right justified,
only the closing line.
It's just *not* pretty IMHO. Certainly not girl code [1]
Mmmm.. girls.. coding.. :)
The frowning surely would be at the mixing of logic and presentation,
Sounds like you got MVC-itis. PHP can't really help with that since
it's a templating language.
Try Rubyonrails, it's the best cure for the MVC itch.
regardless how that mix happens (heredoc, echo, jumping in and out of
PHP tags, sprintf, etc).
I love me some heredoc syntax:
#!/usr/bin/env perl -w
$x = <<END;
hello world!
END
print $x;
#!/usr/bin/env ruby -w
x = <<END
hello world!
END
puts x
#!/usr/bin/env python
x = """
hello world!
"""
print x
--
Greg Donald
http://destiney.com/
--- End Message ---
--- Begin Message ---
On 4/30/07, Greg Donald <[EMAIL PROTECTED]> wrote:
All parts of a heredoc statement do not have to be right justified,
only the closing line.
I meant my other right, the one on my left. Sorry.
--
Greg Donald
http://destiney.com/
--- End Message ---
--- Begin Message ---
On Mon, 2007-04-30 at 19:42 -0500, Greg Donald wrote:
> On 4/30/07, Richard Davey <[EMAIL PROTECTED]> wrote:
> > I'm not dissing heredoc syntax, it has its uses (now and again) but it's
> > far from "clean", especially when embedded deep in classes
>
> Classes? PHP is the absolute worst language to do OO programming in.
> If you like OO, move on to ruby or python.
You sissy, Ruby and Python suck. One baseless statement deserves
another. Feel free to back up your statement with verifiable proof.
> , you'll be much happier. Or
> you can wait around until PHP fully (d)evolves into Java.
Unlikely.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
Greg Donald wrote:
Try Rubyonrails, it's the best cure for the MVC itch.
Django framework is pretty nice too. :)
--
Wishlists: <http://snipurl.com/1gqpj>
Switch: <http://browsehappy.com/>
BCC?: <http://snipurl.com/w6f8>
My: <http://del.icio.us/mhulse>
--- End Message ---
--- Begin Message ---
On Monday 30 April 2007, Greg Donald wrote:
> Sounds like you got MVC-itis. PHP can't really help with that since
> it's a templating language.
>
> Try Rubyonrails, it's the best cure for the MVC itch.
Except that it's a PAC framework, not MVC, like the vast majority of web apps
frameworks out there in any language. The web just doesn't lend itself to
MVC. Sun just likes to get their terminology wrong and confuse everyone for
the next decade.
http://www.garfieldtech.com/blog/mvc-vs-pac
--
Larry Garfield AIM: LOLG42
[EMAIL PROTECTED] ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson
--- End Message ---
--- Begin Message ---
I am new to PHP programming and need some help. I have an image that i
have show up each May for the month with $mymonth = date("m", mktime()),
but i want to set up a date range for it to show up. Ex. 4-13 to 5-13
each year. How can I do that? Any help would be great.
Thank you
Ben
--- End Message ---
--- Begin Message ---
One way would be to do this:
<?
if(date("md") > 413 && date("md") < 513) {
// Display image
}
?>
On 4/30/07, Ben Clapp <[EMAIL PROTECTED]> wrote:
I am new to PHP programming and need some help. I have an image that i
have show up each May for the month with $mymonth = date("m", mktime()),
but i want to set up a date range for it to show up. Ex. 4-13 to 5-13
each year. How can I do that? Any help would be great.
Thank you
Ben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
--- End Message ---
--- Begin Message ---
Ben Clapp wrote:
I am new to PHP programming and need some help. I have an image that i
have show up each May for the month with $mymonth = date("m", mktime()),
but i want to set up a date range for it to show up. Ex. 4-13 to 5-13
each year. How can I do that? Any help would be great.
There are loads of ways, but hopefully as you're new to PHP this one
will be easy to follow and make sense:
$start_date = strtotime('4 August 2007');
$end_date = strtotime('9 October 2007');
$current = time();
if ($current >= $start_date && $current <= $end_date)
{
// Do whatever should only happen between the
// 4th of August and the 9th of October here
}
strtotime() is extremely powerful / useful, and well worth reading about:
http://uk.php.net/manual/en/function.strtotime.php
Cheers,
Rich
--
Zend Certified Engineer
http://www.corephp.co.uk
"Never trust a computer you can't throw out of a window"
--- End Message ---
--- Begin Message ---
Ben, make sure whatever method you use, you use the operator
combinations >= and <= as Richard just showed you. I had forgotten to do
that, which would mean (in my example) that the 13th of April and 13th of
May of each year would not be counted, only 14 April through 12 May of any
given year. Also, expanding on Richard's example, you can make it dynamic
per year by combining the strtorime() and date() functions, so you wouldn't
have to update your code annually. However, this would only work if both
dates were within the same (current) year at the time the script was
executed:
<?
$start_date = strtotime('4 August '.date("Y"));
$end_date = strtotime('9 October '.date("Y"));
$current = time();
if ($current >= $start_date && $current <= $end_date)
{
// Do whatever should only happen between the
// 4th of August and the 9th of October here
}
?>
On 4/30/07, Richard Davey <[EMAIL PROTECTED]> wrote:
Ben Clapp wrote:
> I am new to PHP programming and need some help. I have an image that i
> have show up each May for the month with $mymonth = date("m", mktime()),
> but i want to set up a date range for it to show up. Ex. 4-13 to 5-13
> each year. How can I do that? Any help would be great.
There are loads of ways, but hopefully as you're new to PHP this one
will be easy to follow and make sense:
$start_date = strtotime('4 August 2007');
$end_date = strtotime('9 October 2007');
$current = time();
if ($current >= $start_date && $current <= $end_date)
{
// Do whatever should only happen between the
// 4th of August and the 9th of October here
}
strtotime() is extremely powerful / useful, and well worth reading about:
http://uk.php.net/manual/en/function.strtotime.php
Cheers,
Rich
--
Zend Certified Engineer
http://www.corephp.co.uk
"Never trust a computer you can't throw out of a window"
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
--- End Message ---
--- Begin Message ---
Thank you both, I will try the code and go from there. Thank you again
Daniel Brown wrote:
Ben, make sure whatever method you use, you use the operator
combinations >= and <= as Richard just showed you. I had forgotten to
do that, which would mean (in my example) that the 13th of April and
13th of May of each year would not be counted, only 14 April through
12 May of any given year. Also, expanding on Richard's example, you
can make it dynamic per year by combining the strtorime() and date()
functions, so you wouldn't have to update your code annually.
However, this would only work if both dates were within the same
(current) year at the time the script was executed:
<?
$start_date = strtotime('4 August '.date("Y"));
$end_date = strtotime('9 October '.date("Y"));
$current = time();
if ($current >= $start_date && $current <= $end_date)
{
// Do whatever should only happen between the
// 4th of August and the 9th of October here
}
?>
On 4/30/07, *Richard Davey * <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Ben Clapp wrote:
> I am new to PHP programming and need some help. I have an image
that i
> have show up each May for the month with $mymonth = date("m",
mktime()),
> but i want to set up a date range for it to show up. Ex. 4-13 to
5-13
> each year. How can I do that? Any help would be great.
There are loads of ways, but hopefully as you're new to PHP this one
will be easy to follow and make sense:
$start_date = strtotime('4 August 2007');
$end_date = strtotime('9 October 2007');
$current = time();
if ($current >= $start_date && $current <= $end_date)
{
// Do whatever should only happen between the
// 4th of August and the 9th of October here
}
strtotime() is extremely powerful / useful, and well worth reading
about:
http://uk.php.net/manual/en/function.strtotime.php
Cheers,
Rich
--
Zend Certified Engineer
http://www.corephp.co.uk
"Never trust a computer you can't throw out of a window"
--
PHP General Mailing List ( http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
--- End Message ---
--- Begin Message ---
Ben Clapp wrote:
Thank you again for the help, it does work now but with an issue, here
is the code that i have for it right now:
You should always reply to the php mailing list, so other people can
benefit from the answers we give.
With this it works, but i am sure that when mymonth == 5 (may 1st,
tomorrow) I will have two of the same pictures.
You are right, you will. Because you're running the mothers day check
twice, once with the 'new' code I gave you, and once with your old code.
If I take out this bit of code from the above code:
then NOTHING shows up. Am I not getting something right or is there
something elese that is getting in the way or is something not being
completed?
You've got missing { } around your if blocks. You also could make the
code a lot more tidy / easy to read. Try the following (it replaces
entirely the code you emailed me, swap all of it for this)
<?php
$mymonth = date('m');
// novenmber is pancreatic cancer month
if ($mymonth == 11)
{
?>
<tr><td align="center" bgcolor="#ffffff"><a
href="http://pancan.com/Patient/pancreatic.html" target="_blank"><img
src="../images/ads/pancanNov_banner.jpg" width="777" height="182"
border="0"></a></td>
</tr>
<?php
}
$start_date = strtotime('13 April '.date("Y"));
$end_date = strtotime('13 May '.date("Y"));
$current = time();
if ($current >= $start_date && $current <= $end_date)
{
?>
<tr><td align="center" bgcolor="#ffffff"><a
href="../images/passportad/mothersdayBanner.jpg" target="_blank"><img
src="../images/passportad/mothersdayBanner.jpg" width="771" height="112"
border="0" /></a></td>
</tr>
<?php
}
?>
Cheers,
Rich
--
Zend Certified Engineer
http://www.corephp.co.uk
"Never trust a computer you can't throw out of a window"
--- End Message ---
--- Begin Message ---
Good catch on the non-list reply, Richard. I didn't even notice that.
On 4/30/07, Richard Davey <[EMAIL PROTECTED]> wrote:
Ben Clapp wrote:
> Thank you again for the help, it does work now but with an issue, here
> is the code that i have for it right now:
You should always reply to the php mailing list, so other people can
benefit from the answers we give.
> With this it works, but i am sure that when mymonth == 5 (may 1st,
> tomorrow) I will have two of the same pictures.
You are right, you will. Because you're running the mothers day check
twice, once with the 'new' code I gave you, and once with your old code.
> If I take out this bit of code from the above code:
> then NOTHING shows up. Am I not getting something right or is there
> something elese that is getting in the way or is something not being
> completed?
You've got missing { } around your if blocks. You also could make the
code a lot more tidy / easy to read. Try the following (it replaces
entirely the code you emailed me, swap all of it for this)
<?php
$mymonth = date('m');
// novenmber is pancreatic cancer month
if ($mymonth == 11)
{
?>
<tr><td align="center" bgcolor="#ffffff"><a
href="http://pancan.com/Patient/pancreatic.html" target="_blank"><img
src="../images/ads/pancanNov_banner.jpg" width="777" height="182"
border="0"></a></td>
</tr>
<?php
}
$start_date = strtotime('13 April '.date("Y"));
$end_date = strtotime('13 May '.date("Y"));
$current = time();
if ($current >= $start_date && $current <= $end_date)
{
?>
<tr><td align="center" bgcolor="#ffffff"><a
href="../images/passportad/mothersdayBanner.jpg" target="_blank"><img
src="../images/passportad/mothersdayBanner.jpg" width="771" height="112"
border="0" /></a></td>
</tr>
<?php
}
?>
Cheers,
Rich
--
Zend Certified Engineer
http://www.corephp.co.uk
"Never trust a computer you can't throw out of a window"
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
--- End Message ---
--- Begin Message ---
> > > echo <<<EOF
> > > BROWSER: $_SERVER[HTTP_USER_AGENT]
> > > EOF;
> >
> > Isn't that form (sans quote marks) deprecated and frowned upon?
>
> <?php
>
> error_reporting( E_ALL );
>
> echo <<<EOF
> BROWSER: $_SERVER[HTTP_USER_AGENT]
> EOF;
>
> Why would cleaner, perfectly error free code be frowned upon?
http://us2.php.net/manual/en/language.types.array.php
"A key may be either an integer or a string. If a key is the standard
representation of an integer, it will be interpreted as such (i.e. "8" will
be interpreted as 8, while "08" will be interpreted as "08")."
I was always under the impression that using:
$_SERVER[HTTP_USER_AGENT] or $foo[myindex]
Was "bad" compared to the proper way of:
$_SERVER['HTTP_USER_AGENT'] or $foo['myindex']
Just like it's:
define('MYTHING', true);
not
define(MYTHING, true);
(again, note the ' marks)
http://us2.php.net/manual/en/function.define.php
http://us2.php.net/manual/en/language.constants.php
"If you use an undefined constant, PHP assumes that you mean the name of the
constant itself, just as if you called it as a string (CONSTANT vs
"CONSTANT"). An error of level E_NOTICE will be issued when this happens.
See also the manual entry on why $foo[bar] is wrong (unless you first
define() bar as a constant). If you simply want to check if a constant is
set, use the defined() function."
So, I think you're relying upon a little work that PHP does for you in that
an undefined CONSTANT is turned into a STRING i.e. "bad". Personally, I
*hate* that it does this work, and would love to see a little stricter
parsing done and throw a fatal error if you try to use an undefined
constant.
D.Vin
--- End Message ---
--- Begin Message ---
> Personally, I
*hate* that it does this work, and would love to see a little stricter
parsing done and throw a fatal error if you try to use an undefined
constant.
You can do this yourself.
See http://php.net/set_error_handler
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
On 01/05/07, Daevid Vincent <[EMAIL PROTECTED]> wrote:
> > > echo <<<EOF
> > > BROWSER: $_SERVER[HTTP_USER_AGENT]
> > > EOF;
> >
> > Isn't that form (sans quote marks) deprecated and frowned upon?
>
> <?php
>
> error_reporting( E_ALL );
>
> echo <<<EOF
> BROWSER: $_SERVER[HTTP_USER_AGENT]
> EOF;
>
> Why would cleaner, perfectly error free code be frowned upon?
http://us2.php.net/manual/en/language.types.array.php
"A key may be either an integer or a string. If a key is the standard
representation of an integer, it will be interpreted as such (i.e. "8" will
be interpreted as 8, while "08" will be interpreted as "08")."
I was always under the impression that using:
$_SERVER[HTTP_USER_AGENT] or $foo[myindex]
Was "bad" compared to the proper way of:
$_SERVER['HTTP_USER_AGENT'] or $foo['myindex']
True, but notice he's using it inside a heredoc string and the rules
are slightly different for string parsing.
http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing
Whereas outside a string, $foo[myindex] will give you a notice and
$foo['myindex'] is OK; Inside a string, $foo[myindex] will give you no
notice and $foo['myindex'] will give you a parse error.
The manual suggests that $foo[myindex] is treated the same inside a
string as outside - if 'myindex' is defined as a constant then that is
what's used as the index. This doesn't seem to be born out by reality.
<?php
error_reporting(E_ALL);
$test = array(
'FOO' => 'Bareword',
'BAR' => 'Constant'
);
define( 'FOO', 'BAR');
print "\$test[FOO]: FOO is interpreted as a $test[FOO]\n";
print "{\$test[FOO]}: FOO is interpreted as a {$test[FOO]}\n";
print "{\$test['FOO']}: FOO is interpreted as a {$test['FOO']}\n";
?>
$ php5 test.php
$test[FOO]: FOO is interpreted as a Bareword
{$test[FOO]}: FOO is interpreted as a Constant
{$test['FOO']}: FOO is interpreted as a Bareword
--- End Message ---
--- Begin Message ---
As this one continues!
Looking for a program that will help me monitor sessions/user/page access to
upload to my server to help me debug what is going wrong.
I must have some conflict going on somewhere in the background and maybe
some monitoring program will help me get to the root of the issue.
Brad
--- End Message ---