PHP print_r() function29 Aug 2024 | 2 min read PHP print_r() is a built-in function that displays information about a variable in a human-readable way. It shows the information stored in a variable, which is easily understandable to the user. There are two more functions similar to print_r() which are var_export(), and var_dump(). They display the private and protected properties of objects. SyntaxParametersThe print_r() function accepts two parameters, which are described below: var_name - It is a required parameter. This parameter specifies the variable about which the information is to be returned. return_output - It is an optional parameter. Use this return_value parameter if you want to capture the output of print_r() function. It is a boolean type of parameter whose default value is FALSE. Return ValuesIf the given variable is an integer, float, or a string, the value of the variable will be returned and printed itself. If the given variable is an array, the values will be printed in the form of keys and value. Similar notation can be used for objects. If the $return_output parameter is set to TRUE, this function will return a string. Otherwise, it will return TRUE. ExamplesBelow some list of examples are given through which you can understand the working of print_r() function - Example 1 In the given example, the variables hold the integer, float, and string type values. Therefore, the value of the variable will be returned itself and printed. Output Integer Value: 501 Float Value: 22.4 String Value: Welcome to javatpoint! Example 2 In the given example, the variable will contain an array. Therefore, values will be printed in the form of keys and value. See the below example Output Array ( [x] => Windows [y] => Mac [z] => Array ( [0] => Linux [1] => Unix [2] => iOS ) ) Next TopicTypes of errors in PHP |
MVC is a software architectural pattern for implementing user interfaces on computers. It divides a given application into three interconnected parts. This is done to separate internal representations of information from the ways information is presented to, and accepted from the user. MVC stands for "Model view...
2 min read
What is Multiple Inheritance? Multiple inheritances are one of the four pillars of OOP object-oriented programming, consisting of a child class or a subclass inheriting the traits from multiple parent classes or superclasses. These classes can reuse the code derived from their parent class after enabling a relationship...
7 min read
PHP has a built-in logical function called gmp_and() or gmp_or(). The gmp_and() function uses to display bitwise AND comparison between two values. This function uses for logical operation using two parameters. Syntax The following syntax shows the GMP bitwise AND functions. <?php gmp_and(parameter1, parameter2); ?> Parameter: The syntax shows two source parameters for...
2 min read
PHP has a built-in function called GMP gmp_clrbit() that clears a bit of a GMP number (GNU Multiple Precision). The gmp_clrbit() function turns off the bit in a GMP number that is at a certain index. The least important bit of the index is zero, so...
2 min read
Stig S. Bakken established the PEAR project in 1999 to advance the re-utilization of code that fills perform collective roles. the main motive of this extension is to give an organized library of code, keep a framework for conveying code and for handling code packages, and...
3 min read
CRUD Operation using PHP & Mongodb In this section, we are going to perform view, insert, delete and update operations. We will use PHP and Mongodb to do this. The database which we used in our application is MongoDB. The step-by-step process to create, update, delete modules...
4 min read
PHP language provides mathematical or logical GMP function called gmp_xor() with essential parameter. The gmp_xor() function works to calculate a bitwise XOR comparison or value between two numbers. The function works for logical operation for two numerical input values. Syntax The syntax shows how to operate the GMP...
3 min read
Ob _ start function is used to create an output buffer in PHP, as we are already aware that PHP is an interpreted language, i.e. any program written in PHP will be executed stepwise, one statement after another, which makes processing comparatively slow compared to others. Therefore,...
4 min read
The factorial number of the largest value is difficult to determine using mathematical operation. PHP language-made function gmp_fact() is used to figure out the factorial number of a GMP parameter. The gmp_fact() function displays factorial data in a single line of code. Syntax The given syntax shows the...
3 min read
PHP has a built-in function called gmp_cmp() that is used to compare two GMP numbers. Syntax The following syntax shows a clear bit function using GMP numbers. gmp_cmp($number1, $number2); Parameter The two GMP numbers such as $number1 and $number2 are required parameters for this function. In PHP versions 5.6 and later, the...
2 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India