foreach($hotel->PropertyAmenities[0] as $amenities) {
$amenity=strtolower(trim($amenities->amenity));
if (strpos($amenity,"number of buildings") ===false && strpos($amenity,"number of rooms")===false && strpos($amenity,"number of floors")===false) {
if(strpos($amenity,"internet")){
$internet.='<li>'.$amenities->amenity.'</li>'."\n";
}
elseif(strpos($amenity,"parking")){
$parking.='<li>'.$amenities->amenity.'</li>'."\n";
}
elseif(strpos($amenity,"billiards") || strpos($amenity,"pool table") || strpos($amenity,"fitness") || strpos($amenity,"gym") || strpos($amenity,"health")){
$activities.='<li>'.$amenities->amenity.'</li>'."\n";
}
elseif(strpos($amenity,"sauna") || strpos($amenity,"steam room") || strpos($amenity,"swimming") || strpos($amenity,"spa ") || strpos($amenity,"massage")){
$activities.='<li>'.$amenities->amenity.'</li>'."\n";
}
else{
echo '<li>'.$amenities->amenity.'</li>'."\n";
}
}
}
<PropertyAmenities size="51"><PropertyAmenity><amenityId>3184708</amenityId><amenity>24-hour front desk </amenity></PropertyAmenity><PropertyAmenity><amenityId>3871936</amenityId><amenity>Accessible bathroom </amenity></PropertyAmenity><PropertyAmenity><amenityId>1125113</amenityId><amenity>Air-conditioned public areas </amenity></PropertyAmenity><PropertyAmenity><amenityId>3184702</amenityId><amenity>Audio-visual equipment </amenity></PropertyAmenity><PropertyAmenity><amenityId>7182368</amenityId><amenity>Babysitting or child care </amenity></PropertyAmenity>
<?php // RAY_temp_garyc123.php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
$xml = '<PropertyAmenities size="51"><PropertyAmenity><amenityId>3184708</amenityId><amenity>24-hour front desk </amenity></PropertyAmenity><PropertyAmenity><amenityId>3871936</amenityId><amenity>Accessible bathroom </amenity></PropertyAmenity><PropertyAmenity><amenityId>1125113</amenityId><amenity>Air-conditioned public areas </amenity></PropertyAmenity><PropertyAmenity><amenityId>3184702</amenityId><amenity>Audio-visual equipment </amenity></PropertyAmenity><PropertyAmenity><amenityId>7182368</amenityId><amenity>Babysitting or child care </amenity></PropertyAmenity>';
$obj = SimpleXML_Load_String($xml);
var_dump($obj);
It would be enormously useful to us (and therefore also useful to you) if you would prepare the SSCCE example that enables us to try to duplicate the error! That would include your actual test data - something that we could parse with SimpleXML. If we get that we can usually show you a code example that demonstrates the correct principles.
ASKER
just added a space
ASKER
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY
Open in new window