M
M
Makfroy2020-10-02 10:03:45
PHP
Makfroy, 2020-10-02 10:03:45

How to parse a specific line from a file?

Hello, I have an xml file with the following content:

<?xml version="1.0" encoding="utf-8" ?> 
<xmlDoc>
<document quantity="1">
<reader>
  <entry>AB:ГОРОДСКОЙ ЧИТАТЕЛЬ</entry> 
  <entry>AA:5502d0933967dc713dea44699088b0cf</entry> 
  <entry>AY:PV6FI</entry> 
  <entry>AG:N/A</entry> 
  <entry>AW:READER</entry> 
  <entry>AX:1988</entry> 
  </reader>
<list>
  <entry codePlace="B001" place="Библиотека" total="1" /> 
  </list>
  </document>
  </xmlDoc>


Parse with php code:

$xml = simplexml_load_file('index.xml');

     foreach ($xml->document->reader->entry as $entry) {
         echo $entry . '<br>';
     }


Now it parses all lines, but how to select specific ones?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2020-10-02
@4Geka

" The if construct is one of the most important in many programming languages, including PHP."

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question