Is it possible to write strictly typed PHP code

0 votes

Is it possible to write code like this?

int $x = 6;
str $y = "hello world";
bool $z = false;
MyObject $foo = new MyObject();

And is it possible to define functions like this?

public int function getBalance()
{
   return 555; //Or any numeric value
}

Can someone please explain if this is possible?

Jun 6 in PHP by Kichu
• 19,040 points
6 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In PHP

0 votes
1 answer

What is a Cookie? How to create Cookies With PHP?

A cookie is often used to identify ...READ MORE

answered Feb 13, 2020 in PHP by Niroj
• 82,720 points
2,005 views
0 votes
1 answer

What is Php Mysql Database? How php connect to database?

Hello kartik, MySQL is the most popular database ...READ MORE

answered Feb 25, 2020 in PHP by Dey
447 views
0 votes
1 answer

How to check if php session is already started or not?

Hello kartik, Use session_id(), it returns an empty string ...READ MORE

answered Apr 1, 2020 in PHP by Niroj
• 82,720 points
2,854 views
0 votes
0 answers
0 votes
1 answer

What is the best way to allow plugins for a PHP application?

Hello @kartik, I've used, it's an attempt to ...READ MORE

answered Apr 15, 2020 in PHP by Niroj
• 82,720 points
187 views
0 votes
1 answer

How to convert PHP code to MySQL query to CSV?

Hello @kartik, Try this: SELECT * INTO OUTFILE "c:/mydata.csv" FIELDS ...READ MORE

answered Aug 20, 2020 in PHP by Niroj
• 82,720 points
977 views
0 votes
0 answers

What does the variable $this mean in PHP?

Can someone please explain how the variable ...READ MORE

Jun 11 in PHP by narikkadan
• 10,640 points
8 views
0 votes
0 answers

What is the difference between public, private, and protected?

When and why should I use public, ...READ MORE

Jun 16 in PHP by narikkadan
• 10,640 points
6 views
+1 vote
2 answers

Scp Php files into server using gradle

Tru something like this: plugins { id ...READ MORE

answered Oct 11, 2018 in DevOps & Agile by lina
• 8,220 points
523 views
0 votes
1 answer

How do I create folder under an Amazon S3 bucket through PHP API?

Of Course, it is possible to create ...READ MORE

answered Apr 24, 2018 in AWS by anonymous
9,123 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP