PHP Functions

PHP Functions In Hindi – Functions In Hindi

PHP

PHP Functions In Hindi:- Function in Hindi in PHP ko Ham Isliye Istemal Karte Hai Taki Hame Ek hi Code Ko Bar Bar Likhna Na Pade Isliye PHP Language Me functions ko Banate hai |

PHP Functions In Hindi

Functions Ko Understand Karne Ke Liye Hamne A to Z Point Ko Cover Kiya Aap Niche Inhe Read Karke Understand Kar Sakte Hain |

What is PHP Function In Hindi ?

Function Line of code ya subprogram Hota hai Inka Ek group Hota Hai Chota program ka us program Me Kitni Bhi Code line ho Sakti Hai or Inka Aapna Ek name & Features Hota Hai Or Function ko Aap Program me Kahi Bhi Call Ya Dobara Istemal Kar Sakte Hai |

Why Use PHP Function in Hindi ?

Jab Ham koi code Likhte hai to Wo code Main ke under hi execute hota hai | Lekin Jab koi program bahut Bada Ho Jaye Or koi code of line Bar Bar repeat ho rhi ho to ham function Bana Sakte hai isse program aashan ho jata hai |

Types of Function In PHP in Hindi

Function Mainly 2 Tarah ke hote hai |

  1. Built-In Function
  2. User-Defined Function

Built-In Function in PHP in Hindi

PHP Main Waise To Built in Function 1000+ Ke Upper Hain Jinhe Aap Keval Call Karke Run Kar Sakte Hain.

Agar Aap Built-in Function Ko Understand Karna Chahte Hain To Aap Niche Link Par Click Karke Learn Kar Sakte Hain |

Click Here :- Built-In Function In PHP

User Defined Function in PHP in Hindi

User Defined Function Ko Ham function Se Create Karte Hain. Aap Niche Syntax Dekh Sakte Hain |

Syntax:

function functionName(Arguments) 
{
  code to be executed;
}
  • function:- Jab ham User-defined function banate hai to hame Function Keyword ka istemal Karna padta hai |
  • Function Name:- Jab Ham User Defined Function Banate hai To ham function ka name dete hai & uska name ham Kuch bhi de sakte hai |
  • Parameter List ( Arguments ):- Parameter List means Hota hai ki use kitne inputs diye Jayenge suppose agar ham Ek 2 number addition ka program banate hai to ham 2 parameter pass karenge |

Example :

function add_Num(int $a, int $b) {
  return $a + $b;
}

Add Two Number using function

<?php
  
function add_Num(int $a , int $b)
{
  return $a + $b;
}

$res = add_Num(5,5);
echo "Addition Of Two Number is : $res";
  ?>

Output:

Addition Of Two Number is : 10

Example 2:

Simple Massage Print Karne Wala Function Banate Hain |

<?php
function writeMsg() {
  echo "Hello world!";
}

writeMsg(); // call the function
?>

Output:

Hello world!

Example 3 :- Find 2 Max Value Using Function in PHP

<?php
function greater_value(int $a, int $b):
      if $a > $b:
         return $a
      else:
         return $b


$c = greater_value(2,3)
echo " Greater Value Is : $c";           
?>

Output:

Greater Value Is : 3

PHP Function Call in Hindi

  1. Call by Value
  2. Call By Reference

Call By Value :- Call by Value Means Ham Jab function ko call karenge to usko value supply krenge ya fir variable ka name supply karenge means waha par jo value hogi wo actual argument se copy ho kar formal argument me chali jayegi. lekin ye value 2 hogi 1 value jo actual argument ke pass hai or 1 iski value copy jo formal argument ke pass hai|

Call By Reference :- Call By Reference Matlab ye keval address ko hold Karta hai |

Leave a Reply

Your email address will not be published. Required fields are marked *