Skip to content
Advertisement

Parse error: syntax error, unexpected ‘unset’ (T_UNSET)

I am using simple php unset() function to remove and index of array but it’s showing the following error:

JavaScript

Here is my erroneous code:

JavaScript

Thanks in advance.

Advertisement

Answer

Try this, Reason for unset($linkExtHelp[0]) assigning to the variable echo $totalArray = You can’t assign the unset() value to the variable, You can use to check before unset and after unset as like below. In other words, unset does not have any return value, since unset is a void. Void – does not provide a result value to its caller.

Syntax: void unset ( mixed $var [, mixed $… ] )

JavaScript

instead of

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement