On 3/31/2013 12:53 AM, John Taylor-Johnston wrote:
I'm using
if($mydata-DPRresponselocationaddress1 != )
is this the same as
if (!isset($mydata-DPRresponselocationaddress))
http://php.net/manual/en/function.isset.php
or
if (!empty($mydata-DPRresponselocationaddress))
This is what I have now and it works. I do know that on the second line I
have $_POST['mort']}\n : ; in the second half. I'm not sure I understand
the comment about use the !empty if you dont care about PHP.
But this is working, and unless someone sees a problem with it, I will leave
it as
Gary wrote:
This is what I have now and it works. I do know that on the second line I
have $_POST['mort']}\n : ; in the second half. I'm not sure I understand
the comment about use the !empty if you dont care about PHP.
if you don't care about PHP Notice...
eror_reporting:
error_reporting( E_ALL | E_STRICT );
if you want to be extremely sure about your app (only in develop)
On Thu, Jun 18, 2009 at 5:04 PM, LAMP l...@afan.net wrote:
Gary wrote:
This is what I have now and it works. I do know that on the second line I
have $_POST['mort']}\n : ; in the second
Martin Scotta wrote:
error_reporting( E_ALL | E_STRICT );
if you want to be extremely sure about your app (only in develop)
Actually, I use error_reporting(E_ALL) while developing
:-)
Afan
On Thu, Jun 18, 2009 at 5:04 PM, LAMP l...@afan.net
mailto:l...@afan.net wrote:
Gary wrote:
Olav Mørkrid wrote:
how do i test if a property of a stdclass object is set, even if its
value is null, similar to how array_key_exists() works for arrays.
the following method fails:
$a-b = null;
if(isset($a-b))
echo yes;
and property_exists() seems only to work for defined
the solution has been found. array_key_exists() can actually be used
on objects, and yields the correct result.
http://no.php.net/array_key_exists
thanks to dordea cosmin for pointing this out.
On 17/08/07, Olav Mørkrid [EMAIL PROTECTED] wrote:
the test i need should give the following
Found something.
For class variables..
http://us.php.net/manual/en/function.property-exists.php
class a {
var $b;
}
if (property_exists('a','b')) {
print yes\n;
}
On 8/17/07, Olav Mørkrid [EMAIL PROTECTED] wrote:
the test i need should give the following results:
- FALSE when $a-b
yes, but that assumes you have a defined class. if $a comes from
mysql_fetch_object() for instance you have just a stdobject, and this
method will produce an error.
On 17/08/07, Michael Preslar [EMAIL PROTECTED] wrote:
Found something.
For class variables..
the test i need should give the following results:
- FALSE when $a-b does not exist at all
- TRUE when $a-b = null
- TRUE when $a-b = any value
empty() gives true for both $a-b = null and not setting any value, so
that's no good.
borokovs suggestion seems to miss the purpose.
anyone else?
On
Maybe if you tell us exactly what you wish to achieve.
Class variables that are not created at object creation is bad design.
Olav Mørkrid schreef:
yes, but that assumes you have a defined class. if $a comes from
mysql_fetch_object() for instance you have just a stdobject, and this
method will
Richard Lynch wrote:
On Tue, April 17, 2007 6:59 am, Tim wrote:
snip
The count is maintained internally as items are
added/removed, and it
is an O(1) operation for PHP to count the array, as it
already knows
the answer and just returns it.
/snip
Hi nothing to do with the actual
After a little test, although the results are not conclusive, I would
say that isset(), and also that array_key_exists() may even use isset()
(or similiar) internally as a first step -let's remember that isset()
only does a fast search and it returns FALSE if the value is NULL; on
the other
On Sat, 2006-02-18 at 04:56, Rafael wrote:
After a little test, although the results are not conclusive, I would
say that isset(), and also that array_key_exists() may even use isset()
(or similiar) internally as a first step -let's remember that isset()
only does a fast search and it
- Original Message -
From: Robert Cummings [EMAIL PROTECTED]
To: Rafael [EMAIL PROTECTED]
Cc: PHP-General php-general@lists.php.net
Sent: Saturday, February 18, 2006 3:21 PM
Subject: Re: [PHP] Re: isset or array_key_exists?
On Sat, 2006-02-18 at 04:56, Rafael wrote:
After a little
Actually, it doesn't have much sense that it creates a variable (or
index), though it had sense why wouldn't be so easily detected, so I
printed the array after the loops and there's no new keys. I think that
if that was the case, it was definitely a bug that has been corrected
(PHP 4.4.0)
On Sat, 2006-02-18 at 12:39, Rafael wrote:
Actually, it doesn't have much sense that it creates a variable (or
index), though it had sense why wouldn't be so easily detected, so I
printed the array after the loops and there's no new keys. I think that
if that was the case, it was
Marek Kilimajer wrote:
M. Sokolewicz wrote:
Also note that empty($non_existent_var) will always throw an E_NOTICE
error when the variable in question is not set.
No, it does not.
hmm... seems to have changed since I last checked (PHP5 change?)
I appoligize :)
--
PHP General Mailing List
* Bret Hughes [EMAIL PROTECTED]:
I just wish there was a use strict; sort of deal so I would not have to
hunt down logic errors due to mistyping a variable name.
There is, in PHP5: E_STRICT. From the manual
(http://php.net/manual/en/ref.errorfunc.php#errorfunc.constants):
Run-time notices.
On Wed, 2005-02-16 at 07:54, Matthew Weier O'Phinney wrote:
* Bret Hughes [EMAIL PROTECTED]:
I just wish there was a use strict; sort of deal so I would not have to
hunt down logic errors due to mistyping a variable name.
There is, in PHP5: E_STRICT. From the manual
Bret Hughes wrote:
On Wed, 2005-02-16 at 07:54, Matthew Weier O'Phinney wrote:
* Bret Hughes [EMAIL PROTECTED]:
I just wish there was a use strict; sort of deal so I would not have
to
hunt down logic errors due to mistyping a variable name.
There is, in PHP5: E_STRICT. From the manual
On Wed, 2005-02-16 at 10:34, Richard Lynch wrote:
Bret Hughes wrote:
On Wed, 2005-02-16 at 07:54, Matthew Weier O'Phinney wrote:
* Bret Hughes [EMAIL PROTECTED]:
I just wish there was a use strict; sort of deal so I would not have
to
hunt down logic errors due to mistyping a variable
It's common mistake what you are doing...
the first thing should be to test if there is such key in array:
if (array_key_exists('cmd',$_POST))
{
}
this means to test it the variable exists, then you can test if it was set
Brona
Chris W. Parker wrote:
M. Sokolewicz mailto:[EMAIL PROTECTED]
on
D_c wrote:
I often use this type of construct
$cmd = $_POST['cmd'];
if ($cmd == null) { // do default
but this throws a notice if the ['cmd'] index is not defined. ugly.
using
if (isset($_POST['cmd'] ) {
$cmd = $_POST['cmd'];
}
seems lengthy. is there a way around this?
i tried using
$cmd
M. Sokolewicz mailto:[EMAIL PROTECTED]
on Tuesday, February 15, 2005 8:25 AM said:
seems lengthy. is there a way around this?
i tried using
$cmd = @ $_POST['cmd'];
to suppress errors but didnt seem to have ay effect.
still
if(isset($_POST['cmd'])) {
$cmd = $_POST['cmd'];
}
Chris W. Parker wrote:
M. Sokolewicz mailto:[EMAIL PROTECTED]
on Tuesday, February 15, 2005 8:25 AM said:
seems lengthy. is there a way around this?
i tried using
$cmd = @ $_POST['cmd'];
to suppress errors but didnt seem to have ay effect.
still
if(isset($_POST['cmd'])) {
$cmd =
M. Sokolewicz wrote:
Also note that empty($non_existent_var) will always throw an E_NOTICE
error when the variable in question is not set.
No, it does not.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Tue, 2005-02-15 at 16:22, M. Sokolewicz wrote:
Chris.
that's a different issue.
There are always at least 2 things you should do with your (expected) input:
1 - check if it *exists* (isset)
2 - check the validity (input-validation)
for step #2 empty is very commonly used, and also a
None of these worked for me. ok, if you look at the code, the part
where echo $_SESSION['uid']; is actually works.
I get a print out of the variable. if i call session_start() before
anything, set variables in $_SESSION, and check it on another page, the
session variables do not exist. in
-Original Message-
From: John Manko [mailto:[EMAIL PROTECTED]
Sent: 30 June 2003 15:14
To: [EMAIL PROTECTED]
Subject: [PHP] Re: IsSet() and $_SESSION
None of these worked for me. ok, if you look at the code, the part
where echo $_SESSION['uid']; is actually works.
I get
It's kinda like microsoft
nothing really works unless you have Internet Explorer and the internet
LOL
Preston Wade [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hello All,
I am trying to use the isset function to test if the page has been
submitted,
i think what you're trying to do is
?php
if($REQUEST_METHOD == POST)
{
echo Form has been submitted.;
exit;
}
else
{
echo Display the form that has to be submitted.':
exit;
}
?
Preston Wade [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hello
5:35 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: isset
i think what you're trying to do is
?php
if($REQUEST_METHOD == POST)
{
echo Form has been submitted.;
exit;
}
else
{
echo Display the form that has to be submitted.':
exit;
}
?
Preston Wade [EMAIL
ubmitted!;
}
?
form action=?=$PHP_SELF ? method=post
blah, blah
input type=submit name=submit value=Submit
/form
-Original Message-
From: vins [EMAIL PROTECTED]@INTERNET@HHC
Sent: Tuesday, July 09, 2002 5:35 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: isset
i think what you'r
If you try and use $var in an operation ( i.e. .= == etc) and you
get an error saying Undefined variable then isset($var) = FALSE
LJ
Erik Price [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hm. I hope I'm not opening an old wound:
Curious about the
If your purpose is to see if an user wrote or selected anything, you can
do:
if (ereg(^[[:blank:]]*$,$_POST['var'])) {
// It has only spaces
}
I am sorry if does not fit your need like I interpreted. But, just for not
getting flamed, !isset() works fine for me on both cases (so far
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] (Erik Price) wrote:
Pretty confusing. Can anyone shed some light on whether or not there is
a final definite way to do this? I've used (!($_POST['var'])) with no
problems in the past, but does good coding style suggest that I use
On Wednesday, February 6, 2002, at 03:28 PM, CC Zona wrote:
PHP's loose typing means that !$somevar evalutes as true if the
variable is
null, if it has an (integer, float, or string) value of zero, if it's an
empty string, or if it is set to boolean false. Or if the variable/index
does
Is there anyway of hiding the name of the website in the isset Enter
Network Password window?
if (isset( $PHP_AUTH_USER ) isset($PHP_AUTH_PW))
No. The browser puts it there, and PHP has no control over it.
And, if you could, it would be in the Location: bar anyway.
Actually... *MAYBE*
Hi,
No, empty(), also does not apply, because it is not set.
It is NOT in the HTTO_POST_VARS Array!
Is this a usual behavior?
Greets,
Alex
--
___
Alexander Lohse
Human Touch Medienproduktion GmbH
Am See 1
17440 Klein Jasedow
Tel: (038374) 75211
Fax: (038374) 75223
40 matches
Mail list logo