Dei and exit function PHP tutorial in Hindi- 104

Dei and exit function PHP tutorial in Hindi Aaj ham is articale ke madhym se samjhenge ke do nye function ke bare me dei() or exit() in do function ke bare me ye dono hi ek hi kaam karte hai. iska ham use tab karte hai jab 10 line ka code likha huaa hai or isme sirf 4 line hi pritn karna hai. baki code rokna hai. tab ham in dono function ka use karte hai.

Iska use ham tab karte hai jab hamare code me andar me koi error aa jata hai. or hame samjh me nhi aata hai tab ham isak use karte hai ek ek line ke andr lagakar chek karte hai ki error hai khan. or ise ham if ek andr pritn karte hai. agar ese dete hai to isme hame error show nhi hoga.

<?php 

echo "hello firnds,<br>";
echo "hello firnds,<br>";
echo "hello firnds,<br>";
echo "hello firnds,<br>";
dei();
echo "hello firnds,<br>";
echo "hello firnds,<br>";
echo "hello firnds,<br>";
echo "hello firnds,<br>";
echo "hello firnds,<br>";

?>

output:-

hello firnds,
hello firnds,
hello firnds,
hello firnds,

Fatal error: Uncaught Error: Call to undefined function dei() in C:\xammp\htdocs\Learn-PHP\deiandexit104.php:7 Stack trace: #0 {main} thrown in C:\xammp\htdocs\Learn-PHP\deiandexit104.php on line 7

ye yhan par dekh sakte hai ki maine code ki 9 line likhi hai par isme mujhe print 4 hi hui hai esa isliye huaa ki maine bich me dei()

yahi kaam exit() se kar sakte hai jhan dei() use kiya hai exit() use kar sakte hai. or ise ham if condition ke andr dalna hai. kuchh is tarike se.

<?php 

echo "hello firnds,<br>";
echo "hello firnds,<br>";
echo "hello firnds,<br>";
echo "hello firnds,<br><br><br>";

if(exit("<b>Here is some Error!</b>"));

echo "hello firnds,<br>";
echo "hello firnds,<br>";
echo "hello firnds,<br>";
echo "hello firnds,<br>";
echo "hello firnds,<br>";

?>

Output:-

hello firnds,
hello firnds,
hello firnds,
hello firnds,

Here is some Error!

ye Error ki jagah ye massage print ho chuka hai. Dei and exit function PHP tutorial in Hindi

You May Also Like

प्रातिक्रिया दे

आपका ईमेल पता प्रकाशित नहीं किया जाएगा. आवश्यक फ़ील्ड चिह्नित हैं *