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



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


Your First PHP code

short url
جواب
 
LinkBack موضوع کے اختیارات موضوع کی درجہ بندی ظاہری انداز
پرانا 30-07-07, 09:39 AM   #1
Member
اجنبی
 
مبشر's Avatar
 
تاریخ شمولیت: Jul 2007
عمر: 27
مراسلات: 75
کمائي: 409
شکریہ: 2
12 مراسلہ میں 28 بارشکریہ ادا کیا گیا
Default Your First PHP code

Your First PHP code


Before you can work with PHP it's a good idea that you install PHP on your computer if you haven�t installed PHP yet, now is a good time to install PHP.

First we will make a simple HTML page


کوڈ:
<html>
<body>
Welcome to PHP tutorial
</body>
</html>
Okay the above HTML page doesn't do anything special but just outputs Welcome to PHP tutorial on the browser. Now lets add some PHP tags to it.

Note: All PHP code is written between <?php and ?> tags, now lets write "Welcome to PHP tutorial" using PHP.

کوڈ:
<html>

<body>



<?php

  echo "Welcome to PHP tutorial";

?>



</body>

</html>
Okay the above PHP script will output Welcome to PHP tutorial Note that we use the echo construct of PHP, the echo function simply outputs the content to the browser.

So if we wanted to write "Welcome" we would write echo "Welcome";

Note: Have you noticed the ; at the end of the statement, Each PHP instruction must end with a semicolon.


Introduction to Variables
Let me introduce you to PHP variables, variables help you store and retrive data.

# All variables start with a dollar sign $

# The name of the variable can consist of letters and numbers, but must begin with a letter. It can also contain special characters like underscore '_', see some examples below:

کوڈ:
$site = 'phpbuddy.com' // valid variable
$4site = 'not yet'; // invalid variable starts with a number
$_4site = 'not yet'; // valid variable starts with an underscore
Some more examples

کوڈ:
$testvariable = 1 + 1; // Assigns a value of 2.
$testvariable = 1 � 1; // Assigns a value of 0.
$testvariable = 2 * 2; // Assigns a value of 4.
$testvariable = 2 / 2; // Assigns a value of 1.
Okay to make things easier I will show you an example here we will create a variables $a, $b and multiply them and store the value in $c, just see it's so simple.



کوڈ:
<?php

$a = 5; //we created a variable a and assigned it a value of 5

$b = 2; //we created a variable b and assigned it a value of 2



$c = $a * $b; //we multiplied the varaible a and b then stored the value in c

echo $c; //we print the content of variable c which is 10

?>


PHP variables can hold strings, dynamic data. PHP variables are case sensitive $a is not the same as $A



کوڈ:
<?php

$a = "Welcome to PHP "; //$a holds the string Welcome to PHP

$A = 4; //$A holds the value 4



echo "Variable a conatains: $a";

echo "Variable A contains: $A";



echo "$a $A"; //outputs both variables $a and $A

?>
مبشر آف لائن ہے  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
مبشر کا شکریہ ادا کیا گیا
جلالپوری (15-10-08)
پرانا 30-07-07, 10:04 AM   #2
Administrator
 
منتظمین's Avatar
 
تاریخ شمولیت: May 2007
عمر: 36
مراسلات: 11,171
کمائي: 167,165
شکریہ: 9,674
7,366 مراسلہ میں 22,057 بارشکریہ ادا کیا گیا
Default جواب: Your First PHP code

سلام!
مبشر بھائی ماءشااللہ بہت اچھا سبق اپ نے لکھا ہے۔ میرے ذہن میں کچھ سوال ہیں

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


والسلام
__________________
تم سپاہی نہیں ہو پیشہ ور قاتلو!
منتظمین آف لائن ہے  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
پرانا 30-07-07, 11:45 AM   #3
Member
اجنبی
 
مبشر's Avatar
 
تاریخ شمولیت: Jul 2007
عمر: 27
مراسلات: 75
کمائي: 409
شکریہ: 2
12 مراسلہ میں 28 بارشکریہ ادا کیا گیا
Default جواب: Your First PHP code

بہت شکریہ بھائی.
;
یہ سائن Statment terminator کہلاتا ہے. جو کے ہر Statment کے آخر میں استمال ہوتا ہے.
مبشر آف لائن ہے  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
پرانا 28-12-07, 07:30 PM   #4
Senior Member
 
عرفان حیدر's Avatar
 
تاریخ شمولیت: Dec 2007
مقام: کراچی
عمر: 30
مراسلات: 2,046
کمائي: 8,136
شکریہ: 889
720 مراسلہ میں 1,429 بارشکریہ ادا کیا گیا
عرفان حیدر کو MSN کے ذریعے پیغام ارسال کریں عرفان حیدر کو Yahoo کے ذریعے پیغام ارسال کریں
Default جواب: Your First PHP code

سلام،
مذکورہ دھاگے کو بند کیا جارہا ہے کیوں کہ اس میں گذشتہ ایک مہینے سے کو ئی نیا مراسلہ نہیں ڈالا گیا۔
تما م مراسلے ارسال کرنے والے خواتین و حضرات کا شکریہ۔
وسلام،
عرفان حیدر آف لائن ہے  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
پرانا 25-07-08, 01:26 PM   #5
Junior Member
اجنبی
 
تاریخ شمولیت: Jul 2008
مراسلات: 18
کمائي: 130
شکریہ: 0
11 مراسلہ میں 15 بارشکریہ ادا کیا گیا
Default جواب: Your First PHP code

تھوڑا سا میں بھی اضافہ کر دیتا ہوں اس میں۔
Say that we wanted to store the values that we talked about in the above paragraph. How would we go about doing this? We would first want to make a variable name and then set that equal to the value we want. See our example below for the correct way to do this.
PHPکوڈ:
<?php
$myString 
"Hello!";
echo 
$myString;
echo 
"<h5>I love using PHP!</h5>";
?>
Display:
Hello!
I love using PHP!


Echoing variables is very easy. The PHP developers put in some extra work to make the common task of echoing all variables nearly foolproof! No quotations are required, even if the variable does not hold a string. Below is the correct format for echoing a variable.
PHPکوڈ:
<?php
$my_string 
"Hello Sana.  My name is: ";
$my_number 4;
$my_letter a;
echo 
$my_string;
echo 
$my_number;
echo 
$my_letter;
?>
Display:
Hello Sana. My name is: 4a
sanishan آف لائن ہے  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
sanishan کا شکریہ ادا کیا گیا
جلالپوری (15-10-08)
جواب

Tags
common, computer, data, extra, format, php, بھائی, جواب, حضرات, خواتین


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
موضوع کے اختیارات
ظاہری انداز Rate This Thread
Rate This Thread:


Similar Threads
موضوع موضوع شروع کیا فورم جوابات آخری مراسلہ
Source Code wajee ویب سائٹس کا جائزہ 0 25-02-11 11:45 PM
Philips Unlocking Code yashaka موبائل ریپیرنگ 2 15-01-11 06:46 PM
Code Complete 2 طاھر پروگرامنگ 2 11-06-09 09:35 PM
How To Code? : VB6 aruz .Net اور VB پروگرامنگ 2 19-05-09 12:29 AM
NEC Unlocking Code yashaka موبائل ریپیرنگ 0 24-07-08 10:06 PM


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

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

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