All fields

“PHP 8 Features (Attributes” in Information Technology

17 questions across 1 technology.

Information Technology

17 questions in 1 technology

#QuestionTechnologyTopicLevel
1What are PHP attributes introduced in PHP 8, and how do they provide a structured, native alternative to the older convention of using docblock comments for metadata? PHP › PHP 8 Features (Attributes, Enums, Match, Nullsafe Operator)PHPPHP 8 Features (Attributes, Enums, Match, Nullsafe Operator)Intermediate
2How can PHP 8's readonly properties, enums, and first class callable syntax be combined together to build more robust, immutable, and expressive domain models compared to earlier PHP versions? PHP › PHP 8 Features (Attributes, Enums, Match, Nullsafe Operator)PHPPHP 8 Features (Attributes, Enums, Match, Nullsafe Operator)Advanced
3What is the match expression introduced in PHP 8, and how does it improve upon the traditional switch statement? PHP › PHP 8 Features (Attributes, Enums, Match, Nullsafe Operator)PHPPHP 8 Features (Attributes, Enums, Match, Nullsafe Operator)Beginner
4What is the nullsafe operator introduced in PHP 8, and how does it simplify safely accessing a chain of potentially null properties or methods? PHP › PHP 8 Features (Attributes, Enums, Match, Nullsafe Operator)PHPPHP 8 Features (Attributes, Enums, Match, Nullsafe Operator)Beginner
5What are enums introduced in PHP 8.1, and how do backed enums differ from pure enums in terms of the values they can represent? PHP › PHP 8 Features (Attributes, Enums, Match, Nullsafe Operator)PHPPHP 8 Features (Attributes, Enums, Match, Nullsafe Operator)Intermediate
6How do constructor property promotion, introduced in PHP 8, reduce boilerplate code when defining a class with several properties initialized directly through its constructor? PHP › PHP 8 Features (Attributes, Enums, Match, Nullsafe Operator)PHPPHP 8 Features (Attributes, Enums, Match, Nullsafe Operator)Intermediate
7How do union types and intersection types in PHP 8 provide more expressive and precise type declarations than were previously possible? PHP › PHP 8 Features (Attributes, Enums, Match, Nullsafe Operator)PHPPHP 8 Features (Attributes, Enums, Match, Nullsafe Operator)Advanced
8What is array destructuring in PHP, and how does the list function or short array syntax simplify extracting values from an array? PHP › Arrays in PHPPHPArrays in PHPIntermediate
9How does the Factory pattern help decouple object creation logic from the code that actually uses those objects? PHP › Design Patterns in PHPPHPDesign Patterns in PHPIntermediate
10What are arrow functions introduced in PHP 7.4, and how do they simplify writing short closures compared to traditional anonymous functions? PHP › Closures & Anonymous FunctionsPHPClosures & Anonymous FunctionsIntermediate
11What are named arguments introduced in PHP 8, and how do they improve the readability of function calls with many parameters? PHP › Functions & ScopePHPFunctions & ScopeIntermediate
12How does the readonly property modifier introduced in PHP 8.1 help enforce immutability for specific class properties? PHP › OOPPHPOOPIntermediate
13How do first class callable syntax and higher order functions in modern PHP support building flexible, composable, functional style code? PHP › Closures & Anonymous FunctionsPHPClosures & Anonymous FunctionsAdvanced
14How do enums, introduced in PHP 8.1, provide a more type safe alternative to using class constants for representing a fixed set of related values? PHP › Constants & SuperglobalsPHPConstants & SuperglobalsAdvanced
15How do function type declarations and return type declarations improve code reliability, and how does PHP handle nullable and union types in function signatures? PHP › Functions & ScopePHPFunctions & ScopeAdvanced
16What are PHP 8's enums, and how do they provide a more type safe alternative to using plain class constants for representing a fixed set of related values? PHP › Type Declarations & Strict TypesPHPType Declarations & Strict TypesAdvanced
17What is the difference between class constants and global constants, and how do you define and access a constant within a class? PHP › Constants & SuperglobalsPHPConstants & SuperglobalsIntermediate