E
E
Evgeny Sheleg2011-11-12 14:53:02
Zend Framework
Evgeny Sheleg, 2011-11-12 14:53:02

Zend_Dom_Query. Variable in selector

Hello.

As soon as he didn’t ask Google about his problem, he was silent :( It is

required to make a selection by a selector that is not known in advance:

$znd->query('a[href="/i/$i"]')

where $i is any earlier assigned number.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mark_ablov, 2011-11-12
@Duti_Fruti

Are you new to PHP?
Single quotes do not expand variables.
$znd->query("a[href=\"/i/$i\"]")

M
MT, 2011-11-12
@MTonly

There is also a concatenation:
$znd->query('a[href="/i/' . $i . '"]');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question