Skip to content

PHP – fgetcsv loop for get data from csv file column by column

I have a CSV file with 31 columns and 24 rows. I need with fgetcsv (or maybe another solution) to pass in the CSV and get data column by column. I have one solution: The for loop is working but $data[$col] only gets data from the first column of the CSV, it doesn’t get data from $data[$col] when $col is

Check for key exists in the Aerospike database

Could you please explain why the Aerospike::exists method throws Fatal Error: Code: $aerospike = new Aerospike( [ ‘hosts’ => [ [‘addr’ => ‘127.0.0.1’, ‘port’ => 3000]…

Laravel container and shared instances

I am wondering how Laravel differentiates between singletons(shared instances) and concrete implementations that might be overwritten inside the container. The container has a bind method that looks like this: It also has a singleton method that calls this function but with the $shared argument always being t…

PHP 7 inconsistently throwing errors for division by zero

I am currently trying to understand the behavior of the new error handling in PHP 7. In the PHP Documentation for DivisionByZeroError, it states: DivisionByZeroError is thrown when an attempt is made to divide a number by zero. Fair enough, but it does not throw the DivisionByZeroError when the / operator is …

Cookie aren’t saved

I need to save a cookie, I’m trying to do this with setcookie function, I did: in the browser there is no cookie saved, why? Answer Some of your settings are wrong. I’ve corrected can you try?