I am having problems with assigning a variable name. Part of the code is as follows: my rss parser function endElement($parser, $tagName) { if (($tagName == "ITEM") or ($tagName == "GENERAL")) { $merchantName = htmlspecialchars(trim($this->merchant_name)); $image = new GetImage; // just an test image URL $image->source = 'http://img.dailymail.co.uk/i/pix/2007/12_01/17banksyES_468x606.jpg'; $id =$this->id; $test = $merchantName.'-'.$id; //$test = "thisWorks" $image->givenName = $test; $image->save_to = 'testfolder/'; // with trailing slash at the end $image->quality = '70'; $get = $image->download('gd'); // using GD $this->id = ""; $this->title = ""; $this->daisycon_unique_id = ""; $this->description = ""; $this->img_small = ""; $this->img_large = ""; $this->minimum_price = ""; $this->link = ""; $this->insideitem = false; } PHP: Now part of the class code that doesn't work: if(isSet($this->givenName)) { $new_name = $this->givenName.'.'.$new_image_ext; } PHP: When i use the dynamic variable $new_image_ext isn't being set. So i have something like shopAshop instead of shopAshop.jpg. With test however i do have thisWorks.jpg being saved Should i quote $test like $image->givenName = "$test"; PHP: Any tips? i attached the class
ok, it turns out it isn't the class but the way rss parser. With putty i notice the merchantname had chars like \n\t\t How can i escape those special chars during the parsing of a xml feed?