Skip to content

Commit

Permalink
Merge pull request #1 from spandan0724/spandan0724-patch-1
Browse files Browse the repository at this point in the history
Fix Ebazhanov#6478: Updated php-quiz.md
  • Loading branch information
spandan0724 authored Oct 15, 2023
2 parents 7170c37 + aa1d2b4 commit 2628da3
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 2628da3

Please sign in to comment.