I have tried to use the following code to get a termId from a term:
$term = taxonomy_get_term_by_name($address_string);
$termId = $term[0]->tid;
There is 1 result, but it is appearing as term[30] - so the above code doesn't work.
I thought I could access the term array by looking at the first element - e.g. $term[0]
What am I doing wrong?
Here is the result of var_dump($term):
array (size=1)
30 =>
object(stdClass)[270]
public 'tid' => string '30' (length=2)
public 'vid' => string '4' (length=1)
public 'name' => string 'Thonglor' (length=8)
public 'description' => string '' (length=0)
public 'format' => string 'filtered_html' (length=13)
public 'weight' => string '0' (length=1)
public 'vocabulary_machine_name' => string 'areas' (length=5)
Many thanks,
PW