How are Variables Defined in PHP?

Answers were Sorted based on User's Feedback



How are Variables Defined in PHP?..

Answer / priyanka

php is a loosely typed language i.e without declaring a
variable we can use that,in this variable defined by using $
symbol for example $x

Is This Answer Correct ?    13 Yes 0 No

How are Variables Defined in PHP?..

Answer / master

variable r defined using the $ symbol.for ex: $x,$value etc.
u can even asign the values directly like $x=10 or $x='php';

Is This Answer Correct ?    4 Yes 0 No

How are Variables Defined in PHP?..

Answer / master

ya i agree with priyanka, as she said in php variables r
loosely typed in the sense that , for example if u r wrking
in c and u want to assign int value to a variable then it
is done as int x=3; but in case of php the values r not
assigned along with the data type like int $x=3; (same as
above) instead its only $x=3; and the php parser
understands that it is int type and works accordingly.

hope u guys got it!!!

Is This Answer Correct ?    3 Yes 0 No

How are Variables Defined in PHP?..

Answer / srinivas1982

Variables in PHP declared with $ symbol. ex: $x.

Is This Answer Correct ?    3 Yes 0 No

How are Variables Defined in PHP?..

Answer / muthu

Variables in PHP declared with $ symbol immediately
followed by alphabets or underscore. We can use variables
without declaring also. But if we are accessing one
variable without assigning values, then we will get warning
messages.
For example
<?php
$a=10;
if($a==2)
$b=20;
echo $b;
?>
This will throw warning messages.

Is This Answer Correct ?    1 Yes 0 No

How are Variables Defined in PHP?..

Answer / ranjith

Variables in PHP declared with $ symbol followed by word,
the word should be either alphabit r special symbols

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

What’s the difference between md5(), crc32() and sha1() crypto on PHP? -

2 Answers  


Can anyone explain about join?

3 Answers  


hello experts good morning to everyone ! at present am now learning LAMP course sir( linux, apache,mysql and php) after finishing this course can i create my own website without investment is it possible ? please can any one tell sir and also tell me how can i upload my project after finishing the project in internet ? please tell the ways sir please send ur valuable suggestions to kiranpulsar2007@gmail.com

2 Answers  


Write down the benefits of php7?

0 Answers  


Single choice objective PHP question...

1 Answers  






What is difference between md5 and SHA256?

0 Answers  


What is artisan in php?

0 Answers  


How can we change the maximum size of the files to be uploaded?

0 Answers  


How to generate a character from an ascii value?

0 Answers  


Write a select query that will be displayed the duplicated site name and how many times it is duplicated?

0 Answers  


What is the use of pear in php?

0 Answers  


What is memcache?

0 Answers  


Categories