Php Ke Kuch Jrruri Concepts(In Hindi)

Hello friends web in hindi me apka swaagat hai ajj me is post me php(pre-processor hypertext) ke kuch topic apko sikhauunga..


Echo-
Sbse pehla concept hai echo iska use kisi be word ya number ko page pr show krane ke liye kiya jata hai.echo ek statement hai

echo "hello world";
Result-hello world

Print-

print "hello world";
print "i m php devloper";

Result-hello world
           I m php devloper

Note- apko ye sare code niche diye gye syntex ke andar dal kar execute karne hai


Variable-variables vo chize hai jinme ham data ya information ko store karte haii
Inka fayda ye hai ki ham user se information leker use use store kr skte hai or bad me uska use be kar skte hai
Man lijiye apko age ka variable bnana hai to uska syntax is prkar hoga
%age
Variable likhne ke rules-

1.Har variable ke name ki shuruwat “$” se hogi.
2.variable kitna be lamba ho skta hai.
(chota namm rakhne se use yad rakhna assan hota hai)
3.variable ke name number se start ne ho skte
Example-$12sonu-ye glt trika hai
Example-$sonu12-ye shi trika hai
Variable syntax-
$txt="hello world";
echo $txt;
Result-
Hello world

Php function

Php function dusri programming  ke function ke smann he hai
Function-function ek code ka piece(part) hota hai jo ek ya ek se jyada input leta hai kuch processing krta hai or fir value return karta hai
Apne bhut se function dekhe hoge jese fread(),fopen() etc jo ki builed in function hote hai means pehle se he bne hue.but php hme khud ke function teyar krne ka be feature deta hai
Function me do chizo ka apke liye clear hona bhut jrruri hai
1 pehla kam php function ko create krna.
2.dusra kam php function ko call karna

Php function kese create kare-

Php function ko create krna bhut easy hai.man lo aap chahte hai ki aap es trah ka function create kare jo apko simple message dikhaye jb aap us function ko call kro to
To aap ye example dekhiye
/* define the php function*/
Function writemessage()
{
Echo”this is new message”;
}
/*calling a php function*/
Writemessage();
Result-
This is new message

Php function ek single perameter ke sath (example)

function familyname($fname){
echo  "$fname kashyap";
}
familyname("love");
familyname("ram");
Result-
Love kashyap
Ram kashyap


(Function do parameters ke sath)

function familyname($fname,$year)
{
echo "$fname kashyap born in $year
}
familyname("sonu","1990")
familyname("rahul","1991")
familyname("rohit","1992")
familyname("sahil","1997")
Result-
sonu born in 1990
rahul born in 1991
rohit born in 1992
sahil born in 1997
Agar apko post se related koi be problem hai to to aap comment me apna swaal puch skte hai.
Thank you

Previous
Next Post »
Thanks for your comment