Hướng dẫn dùng means hindi trong PHP
Learn PHPPHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. Show
PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft's ASP. Start learning PHP now » Easy Learning with "PHP Tryit"With our online "PHP Tryit" editor, you can edit the PHP code, and click on a button to view the result. Example
echo "My first PHP script!"; Try it Yourself » Click on the "Try it Yourself" button to see how it works. PHP ExercisesPHP ExamplesLearn by examples! This tutorial supplements all explanations with clarifying examples. See All PHP Examples PHP Quiz TestLearn by taking a quiz! This quiz will give you a signal of how much you know, or do not know, about PHP. Start PHP Quiz! My LearningTrack your progress with the free "My Learning" program here at W3Schools. Log into your account, and start earning points! This is an optional feature, you can study W3Schools without using My Learning. PHP ReferencesW3Schools' PHP reference contains different categories of all PHP functions, keywords and constants, along with examples. Kickstart your careerGet certified by completing the course Get certified w3schoolsCERTIFIED.2022PHP मे Function का उपयोग Code के Reduplication को कम करने के लिए किया जाता है. Function के उपयोग से Code की Clarity मे सुधार किया जाता है Function सरल Pieces मे Complex Problems को भी कम कर देता है. Nội dung chính
Function Statement का एक Section होता है जिसका उपयोग किसी कार्यक्रम में बार-बार किया जा सकता है. यह Page के Load होने पर तत्काल Execute नहीं होता है इसे Function पर Call करके Execute किया जाता है. Function Code का एक Piece है जो Parameter के रूप में Input लेता है और Processing के बाद एक Value Return देता है. PHP मे Function अन्य Programming Language के कार्यों के समान होती है. इसको Declare करने के लिए Function Keywords की आवश्यकता होती है. Function को Body मे Define या Execute किया जाता है जो Curly Bracket के बीच मे होता है. PHP Language में हजारों built-in Functions हैं. Functions With ParametersPHP आपको एक functions के अंदर अपने Parameters को पास करने का विकल्प देता है जिससे आप ज्यादा Parameters को पास कर सकते है. For Example
OutputTotal of the two numbers is : 95 Passing Arguments by ReferenceFunctions को Reference द्वारा Arguments भेजना संभव है. इसका मतलब है कि Variable के Reference में Functions के द्वारा Variable की Value को कापी के बजाय हेरफेर किया जाता है. For Example
Output Original Value is 30 Dynamic FunctionFunction के नाम को Variables के रूप में Assign करना मुमकिन है और फिर इन Variables को उसी तरह से व्यवहार करना चाहिए जैसा आप Function नाम ही करेंगे. For Example
OutputYou are calling printText function dynamically. Function Returning Valueएक Function Value या Object के साथ संयोजन के साथ Return Statement का उपयोग करके एक Value को वापस कर सकता है. Return Function के निष्पादन को बंद कर देता है और Value वापस कॉलिंग कोड को भेजता है. For Example
OutputTotal of the two numbers is : 77 PHP Articles in HindiFunction reusable piece of code या block of code होता है जो कि कोई specific task perform करता है। एक बार define करने के बाद हम इन्हें कितनी ही बार use कर सकते हैं। PHP में 1000+ predefined useful function हैं जिन्हें हम Built In Functions कहते हैं। हालाँकि PHP हमें ये facility provide करती है कि user खुद के function define कर सके जिनहे User Defines Functions कहते हैं । Web page load होते समय कोई भी function automatically run नहीं होता है जब तक कि हम उसे call न करें। PHP Function Syntaxfunction function_name() { //perform task here return something /*it's optional*/ } Function में return statement optional होता है , आप चाहे तो कोई value या statement return करा सकते हैं। PHP Function ExampleFile : function.php
Output Hell ! this is my first user defined function. PHP Function : Important Tips1. आप एक ही name के function define नहीं कर सकते , अगर आप ऐसा करते हैं तो PHP Fatal Error Generate कर देगी। 2. PHP में Functions नाम ASCII characters A to Z के लिए case insensitive होते हैं , means myfun() define किये जाने के बाद इसे आप Myfun() या MYFUN() name से भी call करा सकते हैं। Note - PHP में functions और methods दोनों अलग - अलग हैं - Methods किसी Class के अंदर define किये जाते हैं इन्हे हमेशा Class Name या Class Object के साथ access किया जाता है हालाँकि यह method के type पर depend करता है , अगर method static हुआ तो Class Name के साथ access किया जायेगा और अगर non-static हुआ तो Class Object के साथ access किया जायेगा। जबकि function out of the class define किया जाते है , ये Class / Object के context में नहीं होते इसलिए इन्हें कहीं भी access किया जा सकता है , class के अंदर भी और class के बाहर भी। PHP Function Advantages1. Code Re-usability : functions use करने का सबसे बड़ा advantage यही है कि , हम code को reuse कर सकते हैं। same processing के लिए एक बार function define करने के बाद उसे हम कही भी और कितनी बार भी use कर सकते हैं। 2. Less Code : चूंकि हम same code के लिए functions use करते हैं जिससे Program की length कम जाती है। 3. Reduce Coding Time : Function use करने से coding time reduce होता है , जो कि किसी भी developer के लिए important है। 4. Easy To Understand : Code को समझना आसान हो जाता है। 5. Easy To Maintain : समय के साथ - साथ हमें code update करना पड़ जाता है जिसे हम function की help से आसानी से maintain कर सकते हैं। PHP Types Of FunctionPHP में हम लगभग 7 type के functions use करते हैं।
|