Is there a PHP equivalent of "new Array (number)" in javascript? -


I was trying to convert the original javascript function to PHP, and I saw that a variable was declared < Code> var Variable = new array (13) .

I know that the PHP variable has been declared: $ variable = array ()

but what about this new array ( 13) "13" in ? Which translates to $ variable = array (13) ? I tried but it did not seem to work.

In this JavaScript,

  var results = new array (13);   

It gets in PHP, am I right?

  $ results = array (13); In fact, in this context, you are creating an array of shapes      

.

You do not really need to select ARLs in PHP, but you can do something like this:

  $ result = array_fill (0, 12, zero) ;   

This will create an array with 13 elements (index 0 to 12), whose value is null .

Comments