PHP Security Tips : Hiding php In URL (In Hindi)
Bubble Sort in PHP With Example | How Bubble Sort Works in PHP
Selection Sort in PHP With Example | How does selection sort work in PHP ?
Java program to remove duplicate elements from an array
Linux uname command Example | Linux get OS Info
AWS Storage Service In Hindi : Types of AWS Storage Services
Java program to check if string is a palindrome : check palindrome string in java
Ternary Operator In JavaScript In Hindi | JavaScript Conditional Operator In Hindi
If tutorials available on this website are helpful for you, please whitelist this website in your ad blocker😭 or Donate to help us ❤️ pay for the web hosting to keep the website running.
Normally PHP में जब हम variable को print / echo कराते हैं तो उसकी value print होती है। लेकिन अगर आप उस variable में stored value को actual PHP form में देखना चाहते हैं तो var_export()
function का use कर सकते हैं।
●●●
var_export()
function दिए गए variable की structured information return करता है जो कि actual PHP code होता है। यह var_dump() function के जैसे ही है बस difference इतना है कि var_dump() variable में stored value के बारे में information देता है जो PHP code नहीं होता है।
var_export(mixed $value, bool $return = false): ?string
$value | required
: यह वो variable है जिसे export करना है।
$return | optional
: by default false
set होता है , लेकिन अगर आपने true set किया तो यह सिर्फ variable को represent करेगा मतलब फिर आपको echo
use करना पड़ेगा। और false
के साथ echo
के बिना output print करेगा।
●●●
$a = array (1, 2, array ("a", "b", "c"));
var_export($a);
output
array ( 0 => 1, 1 => 2, 2 => array ( 0 => 'a', 1 => 'b', 2 => 'c', ), )
अब अगर आप true
pass करेंगे तो output देखने के लिए आपको echo
use करना पड़ेगा। हालाँकि output same रहेगा।
$a = array (1, 2, array ("a", "b", "c"));
echo var_export($a, true);
●●●
इसी तरह से stdClass Class को भी export कर सकते हैं।
$obj = new stdClass;
$obj->title = 'Learn programming in hindi';
$obj->website = 'https://learnhindituts.com';
var_export($obj);
Output
(object) array( 'title' => 'Learn programming in hindi', 'website' => 'https://learnhindituts.com', )
और कुछ इसी तरह से normal Class object को भी export कर सकते हैं।
class A {
public $title;
public $website;
}
$a = new A();
$a->title = "Learn programming in hindi";
$a->website = "https://learnhindituts.com";
var_export($a);
Output
\A::__set_state(array( 'title' => 'Learn programming in hindi', 'website' => 'https://learnhindituts.com', ))
●●●
I hope , अब आप PHP में var_export()
function के बारे में अच्छे से समझ गए होंगे ।
Loading ...
Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)
Get connected with me. :) LinkedIn Twitter Instagram Facebook