Length of array saved in entry 0?

26
January 12, 2019, at 12:30 PM

i read information out of a MSSQL database and save this into arrays with a length of 2000. When i echo the entries i get the length of these arrays in the first entry (e.g. amount[0] = 2000).

Does php do this by default or is there no default value?

(The cells in my database which go into these arrays are empty in the first entry)

Thank You

Answer 1

If i understand your question very well. PHP uses a function called count() to determine the length of an array ,you can do somethiing like this,
$x = [12,11,334,56,788,999,45,56,23]; $y = count($x); then change the value of the first array element like this, $x[0] = $y; So whenever you call $x[0] you will get the length of the array.

READ ALSO
PHP: How to create a function to generate string with defined max and min length?

PHP: How to create a function to generate string with defined max and min length?

I want to create a self-defined string with defined length of the stringIt appears the PHP itself isn't providing me the function I desire

28
Possible to disable specific deprecation warnings in Symfony 3.4?

Possible to disable specific deprecation warnings in Symfony 3.4?

I am working on migrating an existing Symfony 28 project to Symfony 3

38
Getting 4004 SQL Server error after execution of stored procedure with JSON input using PHP code

Getting 4004 SQL Server error after execution of stored procedure with JSON input using PHP code

We created a stored procedure in SQL server which takes input parameter as JSONProcedure is giving us results in JSON in the studio management

21
Integrate NTLM Authentication on ubuntu18.04 apache2.4

Integrate NTLM Authentication on ubuntu18.04 apache2.4

what are the things needs to be done to integrate Apache2::AuthenNTLM in apache2 on ubuntu 1804 with php7

41