Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

array_key_exists

Name: Anonymous 2012-02-19 13:57

Hey /prog/,

I'm working on an assignment in my web developing class, and I can't for the life of me figure out how to check if a fucking session cookie has a value in it.  We're supposed to use the array_key_exists function, but all google tells me is how to check for a specific value.  I don't care about a specific value, I just need to check if the cookie has ANYFUCKINGTHING in it. 

I tried array_key_exists("", $var) but no go.  I'm missing something I think. 

Any help? <3

Name: Anonymous 2012-02-19 14:50

>>1
<3
This doesn't help you, you know.

That's PHP, right? If you googled 66php array_key_exists99 and checked http://www.php.net/manual/en/function.array-key-exists.php and scrolled down to the See Also, you'd notice a promising-sounding function array_keys().

Name: Anonymous 2012-02-19 15:10

Thanks for the response.

I saw that, however we aren't to use Isset.  we need to use array_key_exists, however a session value isn't contained in an array.

Name: Anonymous 2012-02-19 15:25

Throw PHP to garbage and start using C++ with FCGI.

Name: Anonymous 2012-02-19 15:30

I would love to do that.  But it's for class :(

Name: Anonymous 2012-02-19 15:42

>>3
If it's a cookie, wouldn't you define which values interest you? So that you may have an array of keys and you know the rest.

Name: Anonymous 2012-02-19 15:49

It is a cookie, but I just need to check for any value.  The cookie is being set based on user input, so the value could be anything.

Name: Anonymous 2012-02-19 16:02

>>7
Yes... but ``value'' in this case could refer to the value associated with a [i]key{/i], so that you may look up the existence of a value in the hash table.

Just convene a key and check if it has something associated to it.

Name: Anonymous 2012-02-19 16:21

>>4
nope nope nope

use node.js. you'll thank me later when you see just how badly it thrashes SEPPLES on hello world benchmarks

Name: Anonymous 2012-02-19 16:50

>>3
But I told you to look at array_keys(), not isset(). Your reading comprehension seems to be lacking.

Name: Anonymous 2012-02-19 22:18

dubs_check_em()

Name: Anonymous 2012-02-19 22:22

>>11
nice_dubs_exists()

Name: Anonymous 2012-02-19 22:39

>>12
moar like real_real_nice_dubs_exists()

Name: Anonymous 2012-02-20 8:38

This is actually a common problem. The best solution is to                               Learn D                                       

Name: Anonymous 2012-02-20 12:06

if key in request:
    print "heeeey the cookie exists"

Don't change these.
Name: Email:
Entire Thread Thread List