Most voted "php-8" questions
PHP 8.0 is a major (major) update to the PHP language. It contains new features and optimizations including named arguments, Union type, attributes (Annotations), argument promotion in the constructor, match expression, nullsafe operator, JIT compilation (Just in time) and type system improvements, error handling and consistency. This version was released on November 26, 2020.
Learn more…11 questions
Sort by count of
-
12
votes2
answers200
viewsWhat are attributes in PHP? (Annotations/Attributes/Decorators)
Lately I have come across some snippets of code that I can’t understand their purpose, are usually used within comments, which doesn’t make much sense to me. Doing research on this subject falls in…
-
9
votes2
answers304
viewsWhat are the differences between match and switch in PHP8?
PHP 8 looks like have already been launched, with a series of changes and new things. Among the changes, they created the expression match. I saw that she reminds a little of the old and traditional…
php characteristic-language php-8 pattern-matchingasked 3 years, 11 months ago Wallace Maxters 102,340 -
5
votes1
answer129
viewsHow do PHP 8 attributes work?
In PHP 8, the attributions, which can be used in classes or methods. Example: namespace MyExample; use Attribute; #[Attribute] class MyAttribute { const VALUE = 'value'; private $value; public…
-
3
votes1
answer164
viewsAbout the behavior of userland functions and internal functions in PHP
There is a proposal to unify the behavior of userland and internal functions in the PHP 8. That currently in particular, when internal functions fail to parse argument types correctly, they fail to…
-
2
votes3
answers104
viewsHow does inheritance work with "Constructor Property Promotion" in PHP 8?
PHP 8 now supports constructor Property Promotion to declare class properties in constructor arguments: class Foo { public function __construct( public $foo, ){} } By making the inheritance by…
-
0
votes0
answers48
viewsInvalid key problem with JWT token and PHP8
Well I’m performing some tests of my project on PHP8 and I’m already refactoring it with some new features of PHP8. But I’m racking my brain with a library I use to work with JWT token. In this case…
-
0
votes1
answer32
viewsHow to access PHP 8 attributes (or Annotations)?
I’m experimenting with the attributes (or Annotations) PHP 8. I created some sample classes and added the class, property and method attributes. <?php #[Attribute] class ClassAttribute {}…
-
0
votes1
answer16
viewsError: Object of class Student could not be converted to string
I am with a small doubt, I was making a web application in PHP that simulated a student, displaying his information as his name, enrollment, note 1, note 2 and the average of these notes, but when I…
-
-1
votes2
answers67
viewsHow to read two integer variables on the same line with PHP?
I would like to know how I can assign values, via console, to two variables of the whole type using the same line. I know how to do this in Python and Java but I don’t know in PHP. Here’s the code…
-
-1
votes0
answers9
viewsI cannot save password encrypted with bcrypt in the database
I encrypt the password with bcrypt and when I will enter in the database it just won’t go but if I put anything else works what I can do ? $senha = \DarkDevs\Bcrypt::hash($senha); $registro =…
-
-2
votes1
answer111
viewsWhat defines an attribute class in PHP 8?
I am using PHP 8 attributes, the documentation of this feature is still rudimentary, it only contains code examples and the api is not documented so I am experiencing the use of the resource. class…