PHP Constants

PHP Constants In Hindi – define (“pi”, 3.142)

PHP

PHP Constants In Hindi:- PHP Constant Variable Ko Change Nhi Kiya Jata Hain And Constant Variable Ko Ham Pure Program Main Ham Istemal Kar Sakte Hain , Constant Ko Create Karne Ke liye define() Function Ka Istemal Kiya Jata Hain |

Constants In PHP In Hindi

Constants Ki Values Change Nhi Ki Ja Sakti Hain And PHP Constant Ke Liye define() Function Ka Istemal Kiya Jata Hain. define() Function Par 2 ya 3 parameters Hote Hain |

Syntax

define(name, value, case-insensitive)

Parameters :

  • name: Yaha Par Ye Constant Variable Ka Name Hain |
  • value : Yaha Par Ye Constant Ki value Hian |
  • case-insensitive: Yaha Par Default False Hota Hain Lekin Agar Hamne Default False Main Constant Variable Name (pi) Ko Istemal Karna Ho To Ham Program ke Under (pi) Ko Likh Kar Sakte Hain, But Agar Ham True Likhe Hain To Ham (PI) Ka Istemal Bhi Kar Sakte Hain |

Example

Create a constant with a case-sensitive name:

<?php
define ("pi" , 3.142);
echo pi;
?>

OutPut

3.142

Example

Create a constant with a case-insensitive name:

<?php
define ("pi" , 3.142 , true);
echo PI;
?>

output

3.142

PHP Constant Arrays In Hindi

PHP7 Main Ham Constant Arrays Bhi Create Kar Sakte Hain , Create Karne Ke Liye define() Function Ka Hi Istemal Kiya Jata Hain |

Example:

<?php
define("Programming", ["Python","C++","C"]);
echo cars[0];
?>

Output:

Python

Leave a Reply

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