Mercurial > hg > webaudioevaluationtool
comparison php/save.php @ 2638:82b6b75a91bc
Same as last
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Thu, 19 Jan 2017 13:09:03 +0000 |
parents | 68299f11d445 |
children | 2d9955974316 |
comparison
equal
deleted
inserted
replaced
2637:68299f11d445 | 2638:82b6b75a91bc |
---|---|
2 | 2 |
3 function findNodeByAttribute($nodeList, $attributeName, $attributeValue) { | 3 function findNodeByAttribute($nodeList, $attributeName, $attributeValue) { |
4 if (empty($attributeName) || empty($attributeValue)) { | 4 if (empty($attributeName) || empty($attributeValue)) { |
5 die("Error: Empty findNodeByAttribute"); | 5 die("Error: Empty findNodeByAttribute"); |
6 } | 6 } |
7 | 7 if (empty($nodeList)) { |
8 return 0; | |
9 } | |
8 foreach($nodeList as $item) { | 10 foreach($nodeList as $item) { |
9 if ($item->hasAttribute($attributeName)) { | 11 if ($item->hasAttribute($attributeName)) { |
10 if ($item->getAttribute($attributeValue) == $attributeValue) { | 12 if ($item->getAttribute($attributeValue) == $attributeValue) { |
11 return $item; | 13 return $item; |
12 } | 14 } |