Skip to main content

Posts

Showing posts with the label PHP programs in Hindi

PHP Strings (PHP class part 9 In Hindi )

  PHP Strings Introduction to PHP Strings जब बहुत से characters को एक साथ sequence में लिखा जाता है तो वे एक string का निर्माण करते है। उदाहरण के लिए India एक string है। ये i,n,d,i,a characters से मिलकर बनी है। एक string निचे दिए गए elements से मिलकर बनी हो सकती है। Letters – एक string small letters (a – z) या capital letters (A – Z) से मिलकर बनी हो सकती है।      Numbers – एक string में zero से लेकर 9 तक का कोई भी number हो सकता है।  Special Characters – एक string में special characters (@#$%^&!) भी हो सकते है। Special characters को string के रूप में display करने के लिए escape sequence characters use किये जाते है।     Web pages और databases में strings का बहुत अधिक महत्व होता है। इसलिए ये जरुरी है की एक scripting language आपको strings के साथ work करने की capability provide करे।   PHP आपको strings के साथ work करने के लिए support provide करती है। PHP में strings create करना और उनके साथ work करना बहुत ही आस...

PHP iterators and generators , Introduction to PHP Iterators ( PHP class part 11

  PHP iterators and generators  Introduction to PHP Iterators  PHP में iterators का प्रयोग objects को iterate करने के लिए किया जाता है। इसे आप ऐसे समझ सकते है। जैसा की आपको पता है PHP में arrays objects है। आप for each लूप का प्रयोग करते हुए array के सभी elements को print करवाते है। Iterate a Class उसी प्रकार आप for each loop में किसी class का object भी पास कर सकते है और उस class को iterate कर सकते है। <?php $arr = array(1,2,3); // Iterating array foreach($arr as $value) { echo $value; } ?> Implement Iterator Interface लेकिन class को for each लूप के द्वारा iterate करने के लिए आपको अपनी class द्वारा Iterator interface को implement करना होगा। और Iterator interface के 5 abstract methods की definition अपनी class में provide करनी होगी। ये methods for loop की तरह ही काम करते है। ये methods निचे दिए जा रहे है – current() – Used to print current value or perform current task. It is same as for loop body. key() – This function represent the...

Introduction to PHP Errors (PHP class part 13 in Hindi )

PHP errors  Introduction to PHP Errors      जब भी आपके code में कोई error आती है तो PHP उसे एक report की तरह show करती है। जितनी भी errors PHP शो करती है वो किसी ना किसी type की होती है। ये सभी types PHP में constants के द्वारा represent किये गए है और इन सभी की value integer होती है। जब किसी constant की value 1 होती है तो वो error आपको शो होती है। और जब तक उस type की error नहीं आती है तब तक constant की value 0 रहती है। आइये इन error types के बारे में detail से जानने का प्रयास करते है। Types of PHP Errors    Constants Description E_Error ये एक रन टाइम error होती है। इससे program रुक जाता है। जैसे की memory allocation problem.      E_WARNING ये रन time warnings होती है इससे program रुकता नहीं है।    E_PARSE ये compile time parse errors होती है।   E_NOTICE ये run time में notice होता है की error generate हो सकती है।   E_CORE_ERROR ये वो error होती है जो PHP के startup में आती है।   E_CORE_WA...