Muhammad
Muhammad

Reputation: 931

is this ok to use an array's key with whitespaces

I am trying to parse a csv file using fgetcsv() function but the CSV file's heading consists value like E-mail Address' which I need to convert as an array's key but I am wondering if it's OK to use a non-standard name for a key?

I would be saving this value in database directly so I am not sure if getting a value like this $entry['E-mail Address'] would be ok

Upvotes: 4

Views: 47

Answers (1)

Mureinik
Mureinik

Reputation: 312404

A string is a string. The fact that it has a whitespace in the middle shouldn't prevent you from using it as an array's key.

Upvotes: 2

Related Questions