thanks a lot MindTrix
i have worked with (( if )) Statement codes om my computer server and all of them working good best regards zahco http://www.arabswell.com/vb/ |
Hey it looks a lot like general if then else statements in HTML, is the if in PHP the same as HTML?
I think the time you take to type these tutorials is a real example of true dedication to coding and sharing open code. I commend you on ur efforts and also hope these types of post will continue, as they certainly help us cut and pasters get a better feel for coding our own ... How bout a tutorial about how to do a eval on voting on a poll. ie. Users cant login to Site till ya vote on a certain poll... Great work and thank you for you time ... |
will there be a part 3? a complex one? arrays and other stuff?
|
Few things to keep in mind about if statements. First, and most important, is that they are the fundemental building block of all programming languages. PHP follows the formatting conventions of C++
Second, if clauses are supported in the XML templates, though their format is different HTML Code:
<if condition=" "> Do This </if> Code:
IF condition THEN In the case of PHP the actions outlined between the {} brackets is carried out only if the statement evaluates to true. If it evaluates to false then the information is ignored. PHP allows you to simply check if a variable is set. For instance PHP Code:
You can set a variable specifically to true or false. Such a variable is known as a Boolean variable. If a variable isn't boolean and you check it then it returns true for all values but Null and 0, which return false. Mindtrix went over == adequately, but you also can check for greater than (>), less than (<), greater than or equal to (>=), lesser than or equal to (<=). All of these are only useful if the compared variables are numeric - I'm don't know how they'll behave if strings are compared. Examples PHP Code:
In in addition to the comparison operands, you will see frequent use of logical operands: NOT, AND, OR, and XOR. These allow you to test multiple conditions. For instance PHP Code:
AND is often shorthanded as && OR evaluates true if either or BOTH the conditions are true. PHP Code:
OR is often shorthanded as || NOT reverses the value of the statement. For instance PHP Code:
Not is always shorthanded "!" in PHP. In visual basic and Javascript you have to write it out. XOR is shor for "Exclusive Or" It excludes the And result. It is logically equivalent to this. PHP Code:
The final example shows exactly how convoluted if statements can get. Sub-statements can be placed in parenthesis to set them apart. Functions and If If a function returns true or false then it can be used in an if statement. For example, the empty function checks to see if a variable is empty (or null). You can use it for a conditional. PHP Code:
PHP Code:
PHP Code:
Hope this flood of tidbits help. |
Please, I need help with this:
This line of code is correct? if (!defined (TABLE_PRX)) or must be: if (!(defined (TABLE_PRX))) Thank you |
Quote:
if (!defined('TABLE_PRX')) |
Thank you for your help :-)
|
You are welcome.
|
thanks man the guide is very usefull
thank you |
interesting thank you ;)
|
All times are GMT. The time now is 05:19 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|