'Add array data by name php

I'm new to arrays. I'd like to know if you can add data to the array by name. This would be an example of what I want to achieve

example:

$guitars = ['names',['Warvick', 'Gibson', 'Fender']];
$guitars[names][] = "Ibanez";
echo "<pre>";
var_dump($guitars);
echo "</pre>";

result

WARNING Use of undefined constant names - assumed 'names' (this will throw an Error in a future version of PHP) on line number 3
array(3) {
  [0]=>
  string(5) "names"
  [1]=>
  array(3) {
    [0]=>
    string(7) "Warvick"
    [1]=>
    string(6) "Gibson"
    [2]=>
    string(6) "Fender"
  }
  ["names"]=>
  array(1) {
    [0]=>
    string(6) "Ibanez"
  }

what I want is to add the data "ibanez" to the array "names" but nevertheless create a new one.

I need it to stay this way. Is there any way to access the data directly by the name "names"?

array(2) {
  [0]=>
  string(5) "names"
  [1]=>
  array(4) {
    [0]=>
    string(7) "Warvick"
    [1]=>
    string(6) "Gibson"
    [2]=>
    string(6) "Fender"
    [3]=>
    string(6) "Ibanez"
  }
}


Solution 1:[1]

Sort of – there is no specific conversion function that would accept a locale, but it can be set for the whole process with os.setlocale:

assert(os.setlocale("de.utf8"))
print(tonumber("1,2"))

This sets the C locale to German (UTF-8), assuming it is installed on the system, which will affect all conversions, but also things like formatting, collation, time etc. You have to use os.setlocale(name, "numeric") to affect only number formatting and parsing rules.

You can do this multiple times, until the conversion succeeds.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 IS4