pkedpker Posted July 6, 2009 Share Posted July 6, 2009 how do I compute math like subtraction in heredoc example.. <img height="6" width="{100-$myHP}"/> output is..... <img height="6" width="100-28"/> you know I want 72.. I'm making HP bars here and no way I cannot use heredoc as there is soo much HTML here its crazy. but if i do ${100-$myHP} I get a variable called 72 -.-.. but not value!.. so im stuck. Soo I tried {${100-$myHP}} and still nothing Link to comment https://forums.phpfreaks.com/topic/164883-solved-math-and-heredoc/ Share on other sites More sharing options...
corbin Posted July 6, 2009 Share Posted July 6, 2009 You can't do math in a heredoc statement. You can either define a variable before hand, or break out of heredoc then get back in it. Link to comment https://forums.phpfreaks.com/topic/164883-solved-math-and-heredoc/#findComment-869495 Share on other sites More sharing options...
pkedpker Posted July 6, 2009 Author Share Posted July 6, 2009 there must be a trick .. but yah i guess i'll doo all variables before hand Link to comment https://forums.phpfreaks.com/topic/164883-solved-math-and-heredoc/#findComment-869500 Share on other sites More sharing options...
corbin Posted July 6, 2009 Share Posted July 6, 2009 http://us2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc Link to comment https://forums.phpfreaks.com/topic/164883-solved-math-and-heredoc/#findComment-869507 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.