Make sure there are no extra characters (including linefeeds) after the
closing ? in your php source file.
Brandon Ryan
On 12 Apr 2005 19:42:17 -, Dipesh Khakhkhar
[EMAIL PROTECTED] wrote:
Hi,
I am using php to generate and xml output file from another xml file using
xsl.
The
On 08 October 2003 17:20, Chris Shiflett wrote:
The internals developers probably didn't see a need to provide
support for return in conditionals since it can't return a value
to the conditional.
Ugh. This is the same misconception, again. Let's try some different
code:
?
function
On 07 October 2003 18:15, Pat Carmody contributed these pearls of wisdom:
So far everyone is telling me that it won't work, but no one
is telling me
why. (btw I did search extensively for the answer to this
question but so
far have found nothing). Robert, could you be more specific
in your
--- Ford, Mike [LSS] [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Firstly, or, as a Boolean operator requires two operands, both of
which must have an actual value.
[snip]
statements don't have a value (and can't even be coerced to have
one), so return can't be valid as one of the operands to
* Thus wrote Chris Shiflett ([EMAIL PROTECTED]):
--- Ford, Mike [LSS] [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Firstly, or, as a Boolean operator requires two operands, both of
which must have an actual value.
[snip]
statements don't have a value (and can't even be coerced to have
On Wed, 2003-10-08 at 11:43, Curt Zirzow wrote:
* Thus wrote Chris Shiflett ([EMAIL PROTECTED]):
--- Ford, Mike [LSS] [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Firstly, or, as a Boolean operator requires two operands, both of
which must have an actual value.
[snip]
statements
* Thus wrote Robert Cummings ([EMAIL PROTECTED]):
On Wed, 2003-10-08 at 11:43, Curt Zirzow wrote:
* Thus wrote Chris Shiflett ([EMAIL PROTECTED]):
--- Ford, Mike [LSS] [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Firstly, or, as a Boolean operator requires two operands, both of
which
On 08 October 2003 16:13, Chris Shiflett contributed these pearls of wisdom:
--- Ford, Mike [LSS] [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
Firstly, or, as a Boolean operator requires two operands,
both of which must have an actual value.
[snip]
statements don't have a value (and
On 08 October 2003 16:43, Robert Cummings contributed these pearls of wisdom:
On Wed, 2003-10-08 at 11:43, Curt Zirzow wrote:
* Thus wrote Chris Shiflett ([EMAIL PROTECTED]):
--- Ford, Mike [LSS] [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
Firstly, or, as a Boolean operator requires two
The internals developers probably didn't see a need to provide
support for return in conditionals since it can't return a value
to the conditional.
Ugh. This is the same misconception, again. Let's try some different code:
?
function foo()
{
echo foo\n;
}
function bar()
{
return
--- Ford, Mike [LSS] [EMAIL PROTECTED] wrote:
No, it's not -- the misconception appears to be yours.
Well, perhaps it is a difference in perspective. Yes, or and || can be
exchanged:
1. if ($foo or $bar) blah();
2. mysql_query($sql) || die(mysql_error());
My point was to differentiate the two
On Tue, 2003-10-07 at 13:02, Pat Carmody wrote:
Calling the following retor_test() function causes a Parse error: parse
error, unexpected T_RETURN message when the script is run:
function istrue() {
return true;
}
function retor_test() {
istrue() or return( False );
return
Well Unfortunately pat
You are going to have to be an unlazy man and use an if statement
Chris
Calling the following retor_test() function causes a Parse error: parse
error, unexpected T_RETURN message when the script is run:
function istrue() {
return true;
}
function retor_test() {
Incidentally your post probably caused you more work than to have tested
it yourself. So much for your laziness even being optimal laziness.
*pt*. I thought making stupid posts was covered in the newbie
guide!?!
Rob.
On Tue, 2003-10-07 at 13:06, Robert Cummings wrote:
On Tue, 2003-10-07 at
So far everyone is telling me that it won't work, but no one is telling me
why. (btw I did search extensively for the answer to this question but so
far have found nothing). Robert, could you be more specific in your
reference to the http://www.php.net documentation? I see nothing on the
basic
I already said Your laziness is causing you problems, this refers back
to your original statement about being lazy. You should be able to infer
form your own wrods the root of your problem.
Rob.
On Tue, 2003-10-07 at 13:14, Pat Carmody wrote:
So far everyone is telling me that it won't work,
On Tue, Oct 07, 2003 at 01:02:36PM -0400, Pat Carmody wrote:
:
: Calling the following retor_test() function causes a Parse error: parse
: error, unexpected T_RETURN message when the script is run:
:
: function istrue() {
: return true;
: }
: function retor_test() {
: istrue() or return(
Chris Sherwood wrote:
Well Unfortunately pat
You are going to have to be an unlazy man and use an if statement
Why won't any of you give a good reason why it won't work? How come this
works:
function foo() {
2+2==4 or die(The world is ending, or at least your processor!);
}
But this
Why won't any of you give a good reason why it won't work? How come this
works:
function foo() {
2+2==4 or die(The world is ending, or at least your processor!);
}
But this doesn't:
function foo() {
2+2==4 or return(The world is ending, or at least your processor!);
}
Robert Cummings wrote:
Directly from the docs:
http://ca3.php.net/manual/en/function.return.php
First line:
If called from within a function, the return() statement
immediately ends execution of the current function
Important concept:
IMMEDIATELY returns.
Learn to read.
What
On Tue, 2003-10-07 at 14:29, Leif K-Brooks wrote:
Robert Cummings wrote:
Directly from the docs:
http://ca3.php.net/manual/en/function.return.php
First line:
If called from within a function, the return() statement
immediately ends execution of the current function
Robert Cummings wrote:
How can you possibly test, in a conditional, the return value of the
return statement itself when it has no value to return and even causes
the current scope to exit IMMEDIATELY??
Ok, that explains it. Thanks.
--
The above message is encrypted with double rot13
How can you possibly test, in a conditional, the return value of the
return statement itself when it has no value to return and even causes
the current scope to exit IMMEDIATELY??
Per the logic, if it returns immediately, isn't the value irrelevant? That
is, assuming that the truth of the
On Tue, 2003-10-07 at 14:40, Roger B.A. Klorese wrote:
How can you possibly test, in a conditional, the return value of the
return statement itself when it has no value to return and even causes
the current scope to exit IMMEDIATELY??
Per the logic, if it returns immediately, isn't the
--- Robert Cummings [EMAIL PROTECTED] wrote:
Directly from the docs:
http://ca3.php.net/manual/en/function.return.php
First line:
If called from within a function, the return() statement
immediately ends execution of the current function
Important concept:
On Tue, 2003-10-07 at 14:45, Chris Shiflett wrote:
--- Robert Cummings [EMAIL PROTECTED] wrote:
Directly from the docs:
http://ca3.php.net/manual/en/function.return.php
First line:
If called from within a function, the return() statement
immediately ends
On Wednesday 08 October 2003 02:51, Robert Cummings wrote:
The original post came from someone being lazy, that appears to be
influencing my take on the thread :) Also given the above code, it's
completely pointless since the first operand is true and so it is
impossible for return( 'foo' )
On Tue, 2003-10-07 at 14:51, Robert Cummings wrote:
The original post came from someone being lazy, that appears to be
influencing my take on the thread :) Also given the above code, it's
completely pointless since the first operand is true and so it is
impossible for return( 'foo' ) to ever
On Tue, 2003-10-07 at 15:00, Jason Wong wrote:
The example given by Leif does not even run. You get a parse error. So all the
discussion about return exiting immediately and the left expression
evaluating to whatever is (IMHO) moot. Apparently PHP does not allow you to
use return like
--- Robert Cummings [EMAIL PROTECTED] wrote:
The original post came from someone being lazy, that appears to be
influencing my take on the thread :)
Understandable. :-)
Also given the above code, it's completely pointless since the first
operand is true and so it is impossible for return(
I would say the real issue at hand here is that the return
statement is
not a fucntion, but rather a language construct, thus it
cannot be used
as a function unless explicitly stated as so. The reason a parse error
is occurring is because this particular construct has no support for
being
--- Robert Cummings [EMAIL PROTECTED] wrote:
Given that die() and exit() works just means they have been given
support for this context.
I think you now understand the original poster's question. From my
interpretation, he simply wanted to know why return was not given the same
support. :-)
On Tue, 2003-10-07 at 15:05, Roger B.A. Klorese wrote:
Sounds to me that if it looks like a function, quacks like a function, etc.,
only a broken language definition would treat it differently from a
function...
Generally it doesn't look like a function since you can do:
return 'foo'
On Tue, 2003-10-07 at 15:08, Chris Shiflett wrote:
--- Robert Cummings [EMAIL PROTECTED] wrote:
Given that die() and exit() works just means they have been given
support for this context.
I think you now understand the original poster's question. From my
interpretation, he simply wanted
Generally it doesn't look like a function since you can do:
return 'foo'
which has no parenthesis.
True enough.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Robert Cummings wrote:
Generally it doesn't look like a function since you can do:
return 'foo'
which has no parenthesis. The parenthesis are optional and only used to
return the result of an expression.
The same is true of exit/die.
--
The above message is encrypted with double rot13
--- Leif K-Brooks [EMAIL PROTECTED] wrote:
The same is true of exit/die.
Right, Robert mentioned this earlier. :-)
So, in summation, someone asked why return wasn't given the same support as
exit (of which die is an alias), and a lot of discussion that didn't answer
this question followed. :-)
On Tue, 2003-10-07 at 15:35, Leif K-Brooks wrote:
Robert Cummings wrote:
Generally it doesn't look like a function since you can do:
return 'foo'
which has no parenthesis. The parenthesis are optional and only used to
return the result of an expression.
The same is true of
* Thus wrote Pat Carmody ([EMAIL PROTECTED]):
Calling the following retor_test() function causes a Parse error: parse
error, unexpected T_RETURN message when the script is run:
function istrue() {
return true;
}
function retor_test() {
istrue() or return( False );
return True;
--- Curt Zirzow [EMAIL PROTECTED] wrote:
I wouldn't call this lazy, more like sloppy and confusing.
return (istrue()? 'True': 'False');
hmm.. less typing, easier to understand and logically readable.
Well, that is arguable. :-) I'm not a big fan of the ternary operator when it
comes to
On Tue, 7 Oct 2003, Curt Zirzow wrote:
function istrue() {
return true;
}
function retor_test() {
istrue() or return( False );
return True;
}
return (istrue()? 'True': 'False');
hmm.. less typing, easier to understand and logically readable.
This doesn't answer the problem
On Tue, 2003-10-07 at 16:53, Pat Carmody wrote:
On Tue, 7 Oct 2003, Curt Zirzow wrote:
function istrue() {
return true;
}
function retor_test() {
istrue() or return( False );
return True;
}
return (istrue()? 'True': 'False');
hmm.. less typing, easier to understand
42 matches
Mail list logo