Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to tell if variable is defined? 1

Status
Not open for further replies.

imstillatwork

IS-IT--Management
Sep 26, 2001
1,605
US
In Cold Fusion we use

<cfif IsDefined(&quot;variable&quot;)>
Use the #variable#
</cfif>

If that &quot;variable&quot; does not exist, this IF would be skipped.

how does me do this in PHP? (very new here, 1st try with php)


 
For a scalar variable, there is isset(). To determine whether a particular array element exists, you can use isset($myarray[<myelement>]) or array_key_exists (&quot;<myelement>&quot;, $myarray).

For more information on PHP's variable functions, read here: Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top