Skip to content

Commit

Permalink
Fix Ebazhanov#6478: Updated php-quiz.md
Browse files Browse the repository at this point in the history
Q86 - Answer Correction: The answer was modified to the first option to accurately represent the behavior of the toString() method in PHP.

Q98 - Typo: Identified a typographical issue in the question description and recommended a revision for clarity and accuracy.

Q99 - Syntax Correction: There were syntax issues in the code examples provided for this question. All answer choices now have corrected syntax by removing the extra ')' before function parameters. Additionally, the answer was updated to the first option, which contains the correct code for file upload in PHP.

New Question Ebazhanov#6478 - A new question `Q106` was added to the PHP quiz. Please review and verify its accuracy.
  • Loading branch information
spandan0724 authored Oct 15, 2023
1 parent 7170c37 commit aa1d2b4
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions php/php-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -1099,9 +1099,9 @@ for($x = 0; $x < $arrlength; $x++){

#### Q86. Which is not true of the `toString()` in PHP?

- [x] It allows you to call an object and see its components as a string.
- [ ] It saves a lot of work of using setters methods to access the values of objects.
- [ ] It saves a lot of work of using getters methods to access the values of objects.
- [x] It allows you to call an object and see its components as a string.
- [ ] It is automatically called when you use echo or print.

#### Q87. What is a generator and how is it used in PHP?
Expand Down Expand Up @@ -1321,8 +1321,6 @@ while ($fruit_name = current($array)) {

#### Q98. What does this code return?

#### Q98. What does this code print?

```php
class Smurf {

Expand All @@ -1349,40 +1347,40 @@ echo $smurf->name;

#### Q99. You have an online form with a file input field called "image" for uploading files. Assuming the path to the upload directory is $path, which code should you use to make sure the file is uploaded from your form to the correct location?

- [ ] :
- [x] :

```php
1 if ($_FILES['image'][error'] == 0) {
2 move_uploaded_file($_FILES)['image']['temp_name'],
1 if ($_FILES['image']['error'] === 0) {
2 move_uploaded_file($_FILES['image']['temp_name'],
3 $path . $_FILES['image']['name']);
4 )
4 }
```

- [maybe] :
- [ ] :

```php
1 if ($_FILES['image'][error'] === false) {
1 if ($_FILES['image']['error'] === false) {
2 move_uploaded_file($_FILES)['image']['temp_name'],
3 $path . $_FILES['image']['name']);
4 )
3 $path . $_FILES['image']['name'];
4 }
```

- [ ] :

```php
1 if ($_FILES['image'][error'] == 0) {
1 if ($_FILES['image']['error'] == 0) {
2 copy($_FILES)['image']['temp_name'],
3 $path . $_FILES['image']['name']);
4 )
3 $path . $_FILES['image']['name'];
4 }
```

- [ ] :

```php
1 if ($_FILES['image'][error'] === false) {
1 if ($_FILES['image']['error'] === false) {
2 upload_file($_FILES)['image']['temp_name'],
3 $path . $_FILES['image']['name']);
4 )
3 $path . $_FILES['image']['name'];
4 }
```

#### Q100. Which super global variable holds information about headers, paths, and script locations?
Expand Down Expand Up @@ -1538,3 +1536,10 @@ while($i>=0) {
2 $initialString = 'All your base are’;
3 append($initialString);
4 echo $initialString;

#### Q106. You want to retrieve input from an input field with the name "city" in a form that's submitted using the POST method. Which superglobal variable should you use?

- [x] $_POST['city']
- [ ] $_POST[city]
- [ ] $POST['city']
- [ ] $_Post['city']

0 comments on commit aa1d2b4

Please sign in to comment.