Register now or log in to join your professional community.
it is possible to write strict typed code which means when we declare value of a variable it
automatically converts it into that data type
like $a='abc' value abc will automatically converted to string value
First thing is that it depends on your knowledge and experiences in my experiences i could write strict code or week code as well. In new php7 you can declare data type like scaler type, return type etc.
Science php known as week then others programming like C, C++, C#, python but the is not what makes php bad world most used programming language is php. But is you wish you can customize you code. Since php7 for example you can define
<?php
declare(strict_types=1);
//Rest of your code here
?>
if you would not like to use strict type then you can disable. PHP7 new feature has made php more reliable and you can use as per your need and requirement.
yes u can write PHP typed code
Yes! In short it is possible. PHP is an OOP language and some of the things are optional. Optional means that you may or may not use them. If you want to use them no one is stopping you. So it is possible to write strict code in PHP.
No. There is support for type hinting since php5 , but "Type Hints can only be of the object and array (since PHP 5.1) type. Traditional type hinting with int and string isn't supported."
PHP is loosely-typed language which is mean that you can use a variable without declaring it. If a variable is used to store integer that mean still access integer as string and reverse is possible too :). Anyway PHP manages that automatically.
I advise you to read the Wikipedia article for Strong and weak typing
NO,
PHP is not strictly typed
Thanks for the invitation.
I don't use PHP. Sorry :)