answersLogoWhite

0


Best Answer

To print a particular value in PHP you have to select which variable you wish to print. Below is an example of how this can be done.

<?php

$var[1] = "Hello";

$var[2] = "Lalala";

print $var[2]; // prints Lalala but not Hello

?>

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you print a particular value using PHP?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you print an HTML table using PHP?

It is really simple to print an HTML table in PHP, all you have to do is the following: &lt;?php print "&lt;table&gt;"; print "&lt;tr&gt;"; print "&lt;td&gt;hello&lt;/td&gt;"; print "&lt;/tr&gt;"; print "&lt;/table&gt;"; ?&gt;


How to display a variable in PHP using echo or print statements?

displaying a variable in php using echo statement? &lt;?php $name="ram"; //declaring and defining the variable echo "$name"; //printing the variable using echo command ?&gt;


What is the Malay-utf-8.inc. php file?

This particular file is a file specific to the PHP program or script you are using. It is not a "php system file".


How do you increment a number using while in php?

Example: &lt;?php $value = 10; $i = 0 if(is_int($value)) { while($i &lt; $value) { echo $i; echo '&lt;br/&gt;'; $i++; } } ?&gt;


How do you insert value to a dropdownlist from textbox input php?

Store the textbox input in a database using a html form prefarably. Using a loop get all the textbox input from database and use print/echo to show them in a dropdown.


How do you display PowerPoint Presentations using PHP?

PHP is not capable of displaying PowerPoint Presentations without another language that does support the display of PowerPoint presentations.Alternatively, you may turn the PowerPoint into a video and print another language capable of displaying videos using PHP.


What is a regular expression in PHP?

echo or print &lt; both of which write text: &lt;?php echo "TEXT"; print "TEXT"; ?&gt;


When should globals be used in PHP?

Problem with using global variables in php is that they lose the the assigned value in a different php file. They only keep the global variable value in the php file in which they are declared. Instead of globals try and use $_SESSION or $_COOKIE to keep value intact across different php files in a project


How do you print 1 to 100 without using loop in php?

The best way to print the numbers 1 to 100 in PHP without using a loop is with the following code: echo implode("&lt;br&gt;", range(1,100)); You can replace the &lt;br&gt; with anything that you want to separate the numbers, such as dashes. I used a line-break in the example.


What is the difference between echo and print in PHP?

Print always returns a value of true, but echo doesn't. echo also has a short cut syntax meaning you can immediately follow the php tags by an equals sign and it will echo the result like in the example shown below: &lt;?=$hello?&gt;


What is the Use of a double dollar sign in php?

A double dollar sign in php makes a variable with a name equal to the value of the original variable. It works like this:$var = "keith";$$var = "palmer";print ($keith);// The output is: palmer


How do you return a value in a PHP function?

Below is a simple example of how you could return a value in a PHP function. &lt;?php function returnme($value) { return $value; } echo returnme('hello'); // outputs: hello ?&gt;