0

I have hard time understanding the syntax of the following function (and others alike):

int fwrite ( resource $handle , string $string [, int $length ] )

what is the meaning of the brackets and comma that follows [, int $length ]. what it should indicate?

3 Answers 3

2

It's simply an optional parameter.

Sign up to request clarification or add additional context in comments.

Comments

0

The the following example:

int fwrite ( resource $handle , string $string [, int $length ] )
  1. The first int represents the data type returned by the function
  2. The expected datatype of each parameter precedes the parameter name
  3. The square brackets indicate optional parameters i.e. the parameters that you can omit
  4. An optional parameter might be followed by a = <some value> indicating the default value that is used if you omit that parameter

Comments

0

[, int $length] indicates an optional parameter you may add when you use the comfort function fwrite. Moreover, it also tells you that it has to be an integer.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.