Skip to content

Instantly share code, notes, and snippets.

@ismail1432
Last active June 7, 2018 14:52
Show Gist options
  • Save ismail1432/7e08544480c0c0ed969738aee3241b47 to your computer and use it in GitHub Desktop.
Save ismail1432/7e08544480c0c0ed969738aee3241b47 to your computer and use it in GitHub Desktop.
PHP 7.2 questions
- question : "In which PHP version can I typehint a Object using the 'object' keyword ?"
answers :
- OK 7.2
- KO 7.0
- KO 7.1
- none of above
- KO 5.6
component : PHP
extra_link : http://php.net/manual/en/migration72.new-features.php
- question : "In which PHP version the void return type has been introduced ?"
answers :
- OK 7.1
- KO 7.0
- KO 7.2
- none of above
- KO 5.6
component : PHP
extra_link : http://php.net/manual/fr/migration71.new-features.php#migration71.new-features.void-functions
- question : "Can I name a class `in_array` ?"
answers :
- OK Yes
- KO No, built-in functions names are not valid
- KO No Array built-in functions names are not valid
component : PHP
extra_link : http://php.net/manual/fr/reserved.php
- question : "What will be the output of this code: `var_dump(1 <=> 2 ? true : false ? false : true);` ?"
answers :
- OK bool(false)
- KO bool(true)
- KO An Error
component : PHP
extra_link : http://php.net/manual/fr/language.operators.comparison.php
- question : |
"Is this code valid :"
```php
class Foo {
private $bar;
public static function setBar($value)
{
$this->bar = $bar;
}
}
```
answers :
- OK No
- KO Yes
component : PHP
extra_link : http://php.net/manual/fr/language.oop5.static.php#language.oop5.static.properties
- question : "Who does support inheritance with the `extends` keyword ?"
answers :
- OK Class
- OK Interface
- KO Trait
- KO Trait
component : PHP
extra_link : http://php.net/manual/fr/language.oop5.inheritance.php
- question : |
"Is this code valid :"
```php
namespace App\Foo;
class Bar{
private $createdAt;
public function __construct()
{
$this->createdAt = new Datetime();
}
}
$bar = new Bar();
```
answers :
- OK No
- KO Yes
component : PHP
extra_link : http://php.net/manual/fr/language.namespaces.fallback.php
- question : |
"Is this code valid :"
```php
interface Bar {
public function getBar() {}
}
interface Foo implements Bar {
public function getFoo() {}
}
```
answers :
- OK No
- KO Yes, Since PHP 7.0
- KO Yes, Since PHP 5.6
component : PHP
extra_link : http://php.net/manual/fr/language.oop5.interfaces.php
- question : "How can I declare a function as abstract ?"
answers :
- OK public abstract function foo();
- OK abstract public function foo();
component : PHP
extra_link : http://php.net/manual/fr/language.oop5.abstract.php
- question :"Which kind of visibility is avaible for an abstract function ?"
answers :
- OK public
- OK protected
- OK private
- KO final
component : PHP
extra_link : http://php.net/manual/fr/language.namespaces.fallback.php
- question : "In which PHP version the finally keyword has been introduced ?"
answers :
- OK 5.5
- KO 5.4
- KO 5.3
- KO 5.6
component : PHP
extra_link : http://php.net/manual/fr/language.exceptions.php
- question : "Is it possible to redefine the visibility of a Trait method ?"
answers :
- OK Yes
- KO No
component : PHP
extra_link : http://php.net/manual/fr/language.oop5.traits.php
- question : "What is the built-in method to get names of all modules compiled and loaded ?"
answers :
- OK get_loaded_extensions
- KO loaded_extensions
- KO get_list_loaded_extensions
- KO list_loaded_extensions
component : PHP
extra_link : http://php.net/manual/en/function.get-loaded-extensions.php
- question : "Since Which PHP version the SPL extension is available and compiled by default ?"
answers :
- OK 5.0
- KO 4.4
- KO 5.3
- KO 5.6
- KO 7.0
component : PHP
extra_link : http://php.net/manual/en/spl.installation.php
- question : "Does a token will prevent a xss attack ?"
answers :
- OK No
- KO Yes
component : PHP
extra_link : https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment