| php پروگرامنگ php پروگرامنگ |
![]() |
|
|
LinkBack | موضوع کے اختیارات | موضوع کی درجہ بندی | ظاہری انداز |
|
|
#1 |
|
Member
اجنبی
تاریخ شمولیت: Jul 2007
عمر: 27
مراسلات: 75
کمائي: 415
شکریہ: 2
12 مراسلہ میں 28 بارشکریہ ادا کیا گیا
|
Okay our task is to make our programs intelligent I mean let's learn how to add decision making logic in our code. PHP like all other good programming languages provides logic and looping by using if and while statements.
Introducing the IF construct The if construct is one of the basic decision making construct, it is also included in PHP. It allows the conditional execution of code fragments. PHP features an if structure that is similar to that of the 'C' language. The syntax for if else structure is کوڈ:
If (conditions)
{
// Code if condition is true
}
else
{
// Code if condition is false
}
Let me give you an example, let's assume that you and your friend are planning to go for a movie and you need more than 20 bucks to go to the movie, if you have less than 20 bucks you can't go, if you would have written a program the PHP equivalent code would be something like this کوڈ:
<?php
$money = 15;
if($money > 20)
{
echo "Hey we can go to the movie, we have $money bucks";
}
else
{
echo "Oops we can't go to the movie, we have only $money bucks";
}
?>
We have used the Comparison operator > Greater than above to check if $money > 20 PHP supports many different comparison operators that allow us to add logic in our code. The comparison operators are listed below: کوڈ:
$a == $b $a is equal to $b $a != $b $a is not equal to $b $a < $b $a is less than $b $a > $b $a is greater than $b $a <= $b $a is less than or equal to $b $a >= $b $a is greater than or equal to $b |
|
|
|
|
#2 |
|
Administrator
![]() ![]() تاریخ شمولیت: May 2007
عمر: 36
مراسلات: 11,361
کمائي: 171,667
شکریہ: 9,810
7,526 مراسلہ میں 22,598 بارشکریہ ادا کیا گیا
|
بہت اچھا حسب سابق کافی مفید ہے۔ لیکن کوشش کریں کہ جلدی نیا سبق دیا کریں۔ کیونکہ کچھ اسباق کے بعد ہی صح چھوٹا موٹا پروگرام بنا سکیں گے-
شکریہ
__________________
تم سپاہی نہیں ہو پیشہ ور قاتلو! |
|
|
|
|
#3 |
|
Senior Member
![]() ![]() |
سلام،
مذکورہ دھاگے کو بند کیا جارہا ہے کیوں کہ اس میں گذشتہ ایک مہینے سے کو ئی نیا مراسلہ نہیں ڈالا گیا۔ تما م مراسلے ارسال کرنے والے خواتین و حضرات کا شکریہ۔ وسلام، |
|
|
![]() |
| Tags |
| friend, php, جواب, حضرات, خواتین |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| موضوع کے اختیارات | |
| ظاہری انداز | Rate This Thread |
|
|
Similar Threads
|
||||
| موضوع | موضوع شروع کیا | فورم | جوابات | آخری مراسلہ |
| Lessons in LOGIC | طاھر | Chit Chat | 2 | 30-06-08 11:13 PM |
| Lessons in Logic | ابو عمار | Chit Chat | 1 | 22-04-08 04:24 PM |
| Adding Send To the Recycle Bin | عبدالقدوس | آئیں کمپیوٹر سیکھیں | 2 | 28-12-07 07:39 AM |
| Simple logic | ابو عمار | Chit Chat | 1 | 02-12-07 11:07 AM |
| Adding Drive to the SendTo List | عبدالقدوس | آئیں کمپیوٹر سیکھیں | 0 | 19-08-07 01:17 PM |