Question: I'm working on an web app which can go in offline mode. An ajax request checks every 5 seconds if a connection is available triggering the php fopen function as this :

```
if (fopen("http://google.com/", "r")) {
    return true;
}
return false;

```

**This is my main question : Is it technically possible that the Apache/PHP get saturated and bring the server down ?**

I've read all that is about on <http://php.net/manual/fr/function.fopen.php> but still can't get a clue about it ?

Answer: 
When you specify a default value in a PHP method (including a constructor), that's all it is - a **default**.

So if you have

```
class Foo {
  public function __construct($mysettings = null) {
    ...
  }
}

```

then you are providing two ways of constructing the class. You can either call

```
$foo = new Foo();

```

with no arguments, in which case `$mysettings` will be initialised to null. Or you can call

```
$settings = array('key' => 'value');
$foo = new Foo($settings);

```

in which case the `$settings` array will be passed into the new instance. The benefit this provides is that you don't need to provide an empty array to new instances for which you don't need custom settings; you can just omit the argument.

The check `if ($mysettings)...` in the class ensures that the settings are only used if they are provided - a PHP `if` statement can operate on lots of different types, not just booleans. In this case, if the variable is null, the condition will evaluate to false.
Have a look at this code:

```
<?php

function required($something)
{
    echo $something;
}

required();

```

It throws a fatal error, because `$something` was required, but not passed. <https://3v4l.org/fIKB9>

Now look here:

```
<?php

function required($something = 'hello')
{
    echo $something;
}

required();
required(' R.Toward');

```

Which outputs `Hello R.Toward` <https://3v4l.org/nQF8r>

So in essence, it is a way of setting a default optional value.