واپس چلیں   پاکستان کی آواز > IT کی دنیا > پروگرامنگ > php پروگرامنگ



php پروگرامنگ php پروگرامنگ


Adding Logic with PHP

short url
موضوع بند کر دیا گیا ہے
 
LinkBack موضوع کے اختیارات موضوع کی درجہ بندی ظاہری انداز
پرانا 31-07-07, 09:36 PM   #1
Member
اجنبی
 
مبشر's Avatar
 
تاریخ شمولیت: Jul 2007
عمر: 27
مراسلات: 75
کمائي: 415
شکریہ: 2
12 مراسلہ میں 28 بارشکریہ ادا کیا گیا
Default Adding Logic with PHP

Adding Logic with PHP

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
مبشر آف لائن ہے  
پرانا 31-07-07, 09:41 PM   #2
Administrator
 
منتظمین's Avatar
 
تاریخ شمولیت: May 2007
عمر: 36
مراسلات: 11,361
کمائي: 171,667
شکریہ: 9,810
7,526 مراسلہ میں 22,598 بارشکریہ ادا کیا گیا
Default جواب: Adding Logic with PHP

بہت اچھا حسب سابق کافی مفید ہے۔ لیکن کوشش کریں کہ جلدی نیا سبق دیا کریں۔ کیونکہ کچھ اسباق کے بعد ہی صح چھوٹا موٹا پروگرام بنا سکیں گے-

شکریہ
__________________
تم سپاہی نہیں ہو پیشہ ور قاتلو!
منتظمین آف لائن ہے  
پرانا 28-12-07, 06:31 PM   #3
Senior Member
 
عرفان حیدر's Avatar
 
تاریخ شمولیت: Dec 2007
مقام: کراچی
عمر: 30
مراسلات: 2,046
کمائي: 8,260
شکریہ: 889
722 مراسلہ میں 1,442 بارشکریہ ادا کیا گیا
عرفان حیدر کو MSN کے ذریعے پیغام ارسال کریں عرفان حیدر کو Yahoo کے ذریعے پیغام ارسال کریں
Default جواب: Adding Logic with PHP

سلام،
مذکورہ دھاگے کو بند کیا جارہا ہے کیوں کہ اس میں گذشتہ ایک مہینے سے کو ئی نیا مراسلہ نہیں ڈالا گیا۔
تما م مراسلے ارسال کرنے والے خواتین و حضرات کا شکریہ۔
وسلام،
عرفان حیدر آف لائن ہے  
موضوع بند کر دیا گیا ہے

Tags
friend, php, جواب, حضرات, خواتین


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
موضوع کے اختیارات
ظاہری انداز Rate This Thread
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


تمام اوقات پاکستانی معیاری وقت ( +5 GMT) کے لحاظ سے ہیں۔ ابھی وقت ہے 08:27 PM

Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
جملہ حقوق نشرو اشاعت ©2000 - 2012,پاکستان کی آواز - پاکستان کے فورمزکی انتظامیہ کے پاس مخفوظ ہیں۔ ہم اردو ترجمے کے لیے جناب زبیرکے مشکور ہیں-
اپنا بلاگ مفت حاصل کریں wordpress.pk
ہم pak.net ڈومین نیم کے لیے جناب فاروق سرور خان کے مشکور ہیں

Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
Ad Management plugin by RedTyger