Jump to content

henka

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

henka's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I just can't see the obvious here, so forgive the question if it seems silly. Given the following: $array['keyval'] = "some data"; Is there a shorter way of coding this expression: $val = $array['keyval'] ? $array['keyval'] : 'keyval'; The above may seem quite short already, but my code uses some rather long 'keyval' strings, eg: $val = $array['this is a rather long string...'] ? $array['this is a rather long string...'] : 'this is a rather long string...'; In other words, without using "foreach ($array as $key => $val)", I want to get at the $key string of a hash. Any ideas?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.