isset Questions
4
Solved
In PHP, how do I test whether an environment variable is set? I would like behavior like this:
// Assuming MYVAR isn't defined yet.
isset(MYVAR); // returns false
putenv("MYVAR=foobar");
isset(MYV...
Nf asked 5/7, 2013 at 7:34
8
Solved
I was trying to call a particular php function in submit of a form both the form and php scripts are in same page. My code is below.(it is not working and so I need help)
<html>
<body>...
20
Solved
I read somewhere that the isset() function treats an empty string as TRUE, therefore isset() is not an effective way to validate text inputs and text boxes from a HTML form.
So you can use e...
14
Solved
I have (or not) a variable $_GET['myvar'] coming from my query string and I want to check if this variable exists and also if the value corresponds to something inside my if statement:
What I'm do...
Curvet asked 24/10, 2010 at 9:51
3
Solved
I mean... I "set" it to NULL. So isset($somethingNULL) == true?
9
Solved
I have a little problem with my if(isset($_POST['submit'])) code. What I want is some echos and a table to not appear when the script is open but I do want it to show when the submit button for the...
Isomerous asked 15/10, 2011 at 3:7
4
I have found that array_key_exists is over 1000x slower than isset at check if a key is set in an array reference. Does anyone that has an understanding of how PHP is implemented explain why this i...
Buatti asked 14/6, 2011 at 0:29
2
Solved
So, looks like they changed the way accessing an array with an unknown key raises a message.
<?php
if($myArray['foo']) { ... }
For 25 years this was simply raising a NOTICE, and people we...
Jodijodie asked 10/12, 2021 at 21:30
28
Solved
In PHP you can do if(isset($array['foo'])) { ... }. In JavaScript you often use if(array.foo) { ... } to do the same, but this is not exactly the same statement. The condition will also evaluate to...
Northcutt asked 17/2, 2010 at 14:54
5
Solved
If you try to read the value of a 'get' variable, what happens if said variable had not been set in the URL. Example: you request the page test.php, in that file it tries to read the value of $_GET...
4
Let me start off by saying I'm a PHP developer, not an ASP one. (And I really wish ASP had isset().) And I'm working in a live environment so I don't really have an opportunity to do any testing.
...
Edmondedmonda asked 4/11, 2010 at 15:46
11
Solved
I need to check if value is defined as anything, including null. isset treats null values as undefined and returns false. Take the following as an example:
$foo = null;
if(isset($foo)) // returns...
11
Solved
This is a bit philosophical but I think many people encountered this problem. The goal is to access various (dynamically declared) properties in PHP and get rid of notices when they are not set.
...
Vivianviviana asked 21/8, 2013 at 15:29
7
Solved
In PHP, I want to check if a variable has not been set/defined, where setting a variable NULL is considered set/defined.
I'm aware everything here:
http://php.net/manual/en/types.comparisons.php
i...
Longtin asked 7/6, 2013 at 21:11
15
Solved
I have a form on one page that submits to another page. There, it checks if the input mail is filled. If so then do something and if it is not filled, do something else. I don't understand why it a...
7
Solved
I also get confused how to check if a variable is false/null when returned from a function.
When to use empty() and when to use isset() to check the condition ?
3
Solved
I am using PHP 7.4 for a laravel application and I am getting this exception very frequently.
ErrorException (E_DEPRECATED)
Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ?...
Parks asked 25/4, 2020 at 20:55
4
Solved
I'm tired to write something like
if (
typeof Foo != 'undefined' &&
typeof Foo.bar != 'undefined' &&
typeof Foo.bar.baz != 'undefined' &&
Foo.bar.baz == 'qux'
) {...}
...
Dactylology asked 11/8, 2011 at 11:5
9
Solved
I've got an array
var assoc_pagine = new Array();
assoc_pagine["home"]=0;
assoc_pagine["about"]=1;
assoc_pagine["work"]=2;
I tried
if (assoc_pagine[var] != "undefined") {
but it doesn't...
Profligate asked 10/4, 2010 at 11:29
11
Solved
We've all encountered it before, needing to print a variable in an input field but not knowing for sure whether the var is set, like this. Basically this is to avoid an e_warning.
<input value=...
5
Solved
So i'm having a bit of a problem with having my PHP run a command if multiple variables exist. I made a simple version for people to see what i'm trying to fix easier. Thanks in advance to anyone w...
1
Here is my python code:
if onerow[0]['result'] is None or not result['GetOdds'][0]['result']is None:
When result was empty, it returns this error:
if onerow[0]['result'] is None or not result['...
9
Solved
I am new to the concept of empty and null. Whilst I have endeavoured to understand the difference between them, I am more confused. I came across an article at http://www.tutorialarena.com/blog/php...
4
Solved
I want to check if the app parameter exists in the URL, but has no value.
Example:
my_url.php?app
I tried isset() and empty(), but don’t work. I’ve seen it done before and I forgot how.
3
If I set a constant to = '',
How to I check if constant has something inside ?
(ie see if it is set to something other than the empty string.)
defined() does not do what I want, because it is alre...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.