A full complete example would be great, otherwise we can play the 20 questions game all day.
You want me to post 700 lines of code which uses WordPress API and explain it to you? I need an answer to one of two questions:
1. How to use a string variable as a path to arrays element?
2. How to make a reference to element inside an array?
I think those questions are strait forward and doesn’t need example at all…
But if you need an example here it is:
//First question $my_array = array('something' => 'foo'); $my_path = '[something]'; echo $my_array.$my_path; // use the path to echo 'something' element (I KNOW THIS IS WRONG) Second Question $my_array = array('something' => 'foo'); $my_element = $my_array['something']; $my_element = 'new value'; // I want this to be changed inside the $my_array so the $my_element needs to be a reference.
You want me to post 700 lines of code which uses WordPress API and explain it to you?
No I don’t mean to be rude, but there probably is a language issue which isn’t helping matters.
$my_array = array('something' => 'foo', 'something2' => 'bar'); //You want to change something to 'hello $my_array['something'] = 'hello'; echo $my_array['something'];
Changing a value in the associative array is simple. Once you know what the key is just change it to your string variable?
Unless you want to loop through the array for the word ‘foo’ and then spit out its associative key pair is ‘something.’ ?
It’s like you’re trying to find the name of the ‘ACTUAL’ variable name of the associative pair unless I totally misunderstood the example.
mmm, glad you solved it anyway.
gees, my eyes are tired, scrolling down the forums I read the title of this thread and read, “After Party” some how inside the title, lol
You’ve probably found what you were looking for since this was posted but I wanted to post this for people who might have stumbled upon this like I have.http://stackoverflow.com/questions/9056021/curly-braces-notation-in-php
If I understood what you want correctly then I think you need ‘variable variables’: http://php.net/manual/en/language.variables.variable.php