Skip to content

Instantly share code, notes, and snippets.

@tivuno
Created November 25, 2022 12:18
Show Gist options
  • Save tivuno/fcc8fa18b47aa58f3bd4bf2d9c128711 to your computer and use it in GitHub Desktop.
Save tivuno/fcc8fa18b47aa58f3bd4bf2d9c128711 to your computer and use it in GitHub Desktop.
<?php
$xml = simplexml_load_file('arxeio1.xml');
$filters = $xml->xpath('products/product/filter');
foreach($filters as $filter) {
$feature_name = trim($filter->filter_name);
if ($feature_name == "ΙΣΧΥΣ/WATT") {
// Do something
echo "1<br />";
} elseif ($feature_name == "LUMEN") {
// Do something else
echo "2<br />";
}
}
$xml = simplexml_load_file('arxeio2.xml');
$filters = $xml->xpath('products/product/attributes/attr');
foreach($filters as $filter) {
$feature_name = trim($filter->name);
if ($feature_name == "Dimmable") {
// Do something
echo "3<br />";
} elseif ($feature_name == "Αριθμός Λαμπτήρων") {
// Do something else
echo "4<br />";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment