what is php data type and echo, print used php in hindi

इस आर्टिकल में हम php के data को detail से समझते हैं. जैसे की what is data type in php and echo, print statement used in php with example के साथ अच्छे से समझते हैं. सबसे पहले data type को जानते की data type क्या होता हैं.

what is datatype in hindi

  • कोई भी data type हमें बताता हैं की हम variable में किसी type की value को store करते हैं.
  • किसी भी programming language में कुछ conman data type होते हैं जैसे की integer, character तथा string आदि.
  • किसी भी computer application में datatype proper way से define होने चहिये जिससे हम proper result मिल सके.
  • php programming language में datatype define करने की जरूरत नहीं होती क्योकि php automatically value के अनुसार उसके datatype में convert कर देता हैं.

php type of datatype

php data type

php में basically 8 type के datatype होते हैं.

  • Integer
  • Floating point number या float
  • String
  • Boolean
  • Array
  • Object
  • Resource
  • Null

इनको भी पढ़े

php data type

सबसे पहले Integer को समझते हैं example के साथ.

Integer – Integer value कोई भी positive तथा Negative होती हैं जिसमे की भी floating point नहीं होता हैं.

  • integer  non decimal number होता हैं.
  • integer range  PHP में    32-bit computer के लिए  – (231 – 1) or -2,147,483,647 से  (231 – 1) or 2,147,483,647. होती हैं.
  • Integer हिन् format में specified होता हैं.
    1. Decimal (10 – based )
    2. Hexadecimal (16 -based )
    3. octal (8 – based )

Example

<?php
$x = 6;
var_dump($x);
?>

output

int(6)

Float float एक कोई भी negative या positive  decimal point number हो सकता हैं.

Example

<?php
$x = 6.5;
$y = -7.66;
var_dump($x, $y);
?>

output

float(6.5) float(-7.66)

String–  string multiple character का commutation होता हैं. जैसे “Hello word”

Example

<?php
$name = "shree";
$my_friend = 'ram';
echo "$name ka friend is $my_friend";
echo "<br>";
var_dump($name,$my_friend);
?>

output

shree ka friend is ram
string(5) "shree" string(3) "ram"

Boolean–  एक boolean value true या false को represent करती हैं. 

Example

<?php
$n1 = false;
$n2 = true;

echo "<br>";
echo var_dump($n1,$n2);
echo "<br>";
?>

Output

bool(false) bool(true)

Array– Array को multiple value को एक variable में store करने के लिये use किया जाता हैं.

Example

<?php
$my_friends = array("Ram", "Mohan", "Sohan", "jitu");
echo var_dump($my_friends);
echo "<br>";
echo $my_friends[0];
echo "<br>";
echo $my_friends[1];
echo "<br>";
echo $my_friends[2];
echo "<br>";
echo $my_friends[3];
echo "<br>";
?>

Output

array(4) { [0]=> string(3) "Ram" [1]=> string(5) "Mohan" [2]=> string(5) "Sohan" [3]=> string(4) "jitu" }
Ram
Mohan
Sohan
jitu

Object  object data type data और information को store करने के लिए use किया जाता हैं.

  • php में object explicitly declared करता हैं.
  • Example – vehicle एक class हैं और कार object हैं.

Resource Data type  php में ये एक special datatype हैं जो किसी external resource के reference को hold करता हैं.

  • अगर हमको किसी variable को check करना हैं की बो resource हैं की नही उसके लिये हमको एक function use करना होगा is_resources.
  • function get_resource_type()  ये हमको उसकी type represent करता हैं.

Null  Null datatype भी एक special datatype हैं जो Empty यानी की खाली represent कारता हैं.

Example

<?php
$a = NULL;
echo var_dump($a);
?>

Output

NULL

echo, print used php in hindi

php programming language में output print करने के लिए दो तरीके हैं . पहला echo तथा दूसरा print इन दोनों statement में ज्यादा different नहीं हैं. दोनों को ही message print करने के लिये use किया जाता हैं.

echo statement

echo कप php में parentheses तथा विना parentheses के भी use कर सकते हैं. जैसे – echo (); echo 

Example

<?php
$my_name = "shreekant singh";
echo $my_name;
echo "<br>";
echo ($my_name);
?>

Output

shreekant singh
shreekant singh

print statement 

print को भी आप उसके parentheses तथा विना parentheses दोनों तरीके से use कर सकते हैं.click

Example

<?php
$my_name = "shreekant singh";
print $my_name;
echo "<br>";
print ($my_name);
?>

Output

shreekant singh
shreekant singh

Deference between echo and print statement in hindi

Parameters echo print
syntax echo is a construed use to display the output can be used with parentheses or with parentheses print is a construed use to display the output can be used with parentheses or with parentheses.
speed echo is faster print is slower or it return value 1
Return echo कोई भी return value नहीं देता. print सदैव 1 value return करता हैं
parameters echo can take more than one parameter. print can only one parameter.
इनको भी पढ़े

आशा  करता हूँ  आपको what is data type in php and echo, print statement used in php with example समझ में गया होगा . अगर आपको इससे related कोई question पूछना है तो आप comment करके पूछ सकते है . हम आपकी comment का जबाब जरुर देंगे . अगर हमारे द्वारा दी गयी जानकारी अच्छी लगी हो तो हमे comment करके जरुर बताये और आपका हमको कोई सुझाब हो तो उसे भी जरुर बताये . दोस्तों आपसे एक request है . आप इस जानकारी को आपने दोस्तों , रेस्तेदारो के साथ जरुर शेयर करे | धन्यबाद

Related Posts

Leave a Comment