spongebobusa Posted August 24, 2006 Share Posted August 24, 2006 I currently have this:[code]$xmlDoc =<<<XML<?xml version="1.0"?><AccessRequest xml:lang="en-US"> <AccessLicenseNumber>123456789</AccessLicenseNumber></AccessRequest>XML;[/code]How can I substitute use a variable inside of a <<<XML XML. For instance, I want to use $number rather than 123456789. Quote Link to comment Share on other sites More sharing options...
jwk811 Posted August 24, 2006 Share Posted August 24, 2006 <AccessLicenseNumber>123456789</AccessLicenseNumber><?php$number="123456789";?>Just add that to the script and I'm pretty sure that would replace the access license number to $number. When you want to use that number just put <?phpecho $number;?>And that number will come up where ever you put it.Hope that helps! Quote Link to comment Share on other sites More sharing options...
448191 Posted August 24, 2006 Share Posted August 24, 2006 That won't do it.This will:[code]<?php$licencenumber = 123456789;$xmlDoc =<<<XML<?xml version="1.0"?><AccessRequest xml:lang="en-US"> <AccessLicenseNumber>$licencenumber</AccessLicenseNumber></AccessRequest>XML;?>[/code]Heredoc (<<) will expand vars as if you were using double quotes. Alternitively, you could look up XML entities. Quote Link to comment Share on other sites More sharing options...
spongebobusa Posted August 24, 2006 Author Share Posted August 24, 2006 I swear I tried that! ;D But it now works! Thanks for the help.[quote author=448191 link=topic=105448.msg421288#msg421288 date=1156406815]That won't do it.This will:[code]<?php$licencenumber = 123456789;$xmlDoc =<<<XML<?xml version="1.0"?><AccessRequest xml:lang="en-US"> <AccessLicenseNumber>$licencenumber</AccessLicenseNumber></AccessRequest>XML;?>[/code]Heredoc (<<) will expand vars as if you were using double quotes. Alternitively, you could look up XML entities.[/quote] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.