String type casing in php, is it string or String?

18
March 15, 2019, at 00:00 AM

What is the official name for the php string type?

Is it 'string' like c#, or 'String' like Java, or either?

I could not find it in http://php.net/manual/en/language.types.string.php

I want to use it to strict type my function

function getImageName() : string;

or

function getImageName() : String;
Answer 1

As PHP is a partially case sensitive language and, in particular, keywords are NOT case sensitive, the case doesn't matter for built-in type names. Both string and String will work as type declaration (aka 'type hint').

The official documentation mentions the lowercase variants, so it's probably a good idea to use lowercase keywords as code style — just like most PHP code styles use foreach and not Foreach, for example.

P.S. You can find the documentation on the PHP Function arguments page, 'Type declarations' section.

READ ALSO
add url parameters to $_GET variable with separated commas issue

add url parameters to $_GET variable with separated commas issue

This is my function, I simply want to output a link like this:

41
How to get current server avaible quota to send emails with PHP

How to get current server avaible quota to send emails with PHP

im in a development of an website that needs to send massive emails to their usersI have done the PHP script to send emails using PHPMailer and its ok, but the server has a limit by hour to send emails

45
.htaccess file is not working properly on Godaddy server

.htaccess file is not working properly on Godaddy server

I have hosted my folder on godaddy linux cpanelWordpress files are in inside /public_html/tma

52
How to make dynamic url with multiple vars like in Laravel?

How to make dynamic url with multiple vars like in Laravel?

How to make dynamic url with multiple vars like in Laravel in my own small MVC? Like when I write Route::get('/post/$1/$2', 'PostsController@showUserPosts')How do you approach this?

47