How can I edit my code to echo the data of child's element where my search term was found in, in XMLReader?

后端 未结 2 1756
时光取名叫无心
时光取名叫无心 2020-12-11 11:54

I am new in XMLReader, and I think is kind of hard to find tutorials/code or something advanced to get examples. My question is how can I transform the code I have now, so i

2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-11 12:26

    Try simplexml -- it's better:

    book as $book) {
        if (preg_match('/' . preg_quote($search) . '/i', $book->name)) {
            echo $book->name . ' (' . $book->info . ')
    '; } }

提交回复
热议问题