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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Understanding PHP syntax

Status
Not open for further replies.

cleanair4me

Technical User
May 16, 2008
61
I am not familiar with PHP terminology and trying to understand the below:

if(isset($_GET['myWord']) && isset($_GET['letters']))
isset means has the value been defined and is not null?


$letters = preg_replace("/[^a-z9 ]/si","",$letters);

preg_replace is a pattern match method that has 3 arguments where first is the reg expression match, second is the replacement and third argument is the variable?
 
you're correct.

isset checks if the var exists, to avoid showing a notice that some var is not defined.

the third argument of preg_replace is the text where you want to perform the replacement.
 
isset will also report false if the variable exists but is set to null. so be careful - it's not always the best test to use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top