PHP is loosely Typed Language but could someone tell me, What is the default data type of any PHP variable? What is its implicit data Type?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The OP understands that PHP is a loosely typed language and therefore the type of any initialized variable is determined by the data it holds; so read that way, the question then becomes What is the type of an uninitialized variable? – the answer to which is
nullPHP doesn’t generally allow you to declare variables without initializing them, there’s no direct equivalent to:
Therefore the only way to see that “default” data type is to evaluate either a variable that hasn’t been set or a class member that holds no data.
1: A variable that hasn’t been set
2: A declared class member that holds no data
Therefore:
the type of any initialized variable is determined by the data it holds
the type of any uninitialized variable is
null