top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

If the variable $a is equal to 5 and variable $b is equal to character a, what’s the value of $$b?

+1 vote
588 views
If the variable $a is equal to 5 and variable $b is equal to character a, what’s the value of $$b?
posted Apr 2, 2015 by Vrije Mani Upadhyay

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

I tested the following code

<?php 
$a=5;
$b=a;
echo $$b;
?>

Output is 5 :)

answer Apr 2, 2015 by Salil Agrawal
why we used $$ this sign as two  times for print the value???
$$b means $a in the above example, $makes a text into a variable when we say $$ i.e. $$b which means $b is a variable with value a and a is also a variable as there is another $ present.
Similar Questions
0 votes

PHP:: Suppose I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, whats the problem?

0 votes
for($i=0;$i<=feof($getdata);$i++)
{
if (filter_var($data[$i][1], FILTER_VALIDATE_EMAIL)){
echo $data[$i][1];
$email=$data[$i][1];
$conn = mysqli_connect($dbhost,$dbuser,$dbpass, $dbname);
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}
$sql ="INSERT INTO promo_user (uid,name,email) VALUES (,'', '$email')";
mysqli_query($sql,$conn);
mysqli_close($conn);

I am using the above code but there is something wrong with it,whenever i run the code the echo is working fine but the content does go into sql table

Please help

...