IchHabsDrauf IchHabsDrauf - 1 year ago 52
PHP Question

NOTICE Array to string conversion on line number ... [multidimensional array]

I have this simple array defined:

1: <?php
2: $_ext = array(
3: array('doc', 'docx'),
4: array('xls', 'xlsx'),
5: array('ppt', 'pptx'),
6: array('php'),
array('html'),
array('pdf'),
array('js').
array('java'),
array('zip', 'rar')
);


When I run it i get the following error

NOTICE Array to string conversion on line number 3

NOTICE Array to string conversion on line number 3

I even tested this on the webpage http://phptester.net/ and I got the same error. I don't know which php version my host is using but probably the newest.

I read this w3schools article (https://www.w3schools.com/php/php_arrays_multi.asp) about multidimensional arrays and I don't really know what I am doing wrong.

Thank you in advance for your help. :)

Answer Source

Check the line array('js').. There's a typo: Try replacing the point with a comma.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download