lasse48 Posted August 19, 2010 Share Posted August 19, 2010 hello guys , can you guys see any errors in this code`? i cant seem to find it :-\ <?php $units_stats_1 = array(40, 35, 50); $units_stats_2 = array($units_stats_1[0] * 50%, $units_stats_1[1] * 100%, $units_stats_1[2] * 100%); echo $units_stats_2; ?> i allso tryed to do : echo $units_stats_2[0]; thanks Quote Link to comment https://forums.phpfreaks.com/topic/211151-php-array-with-help-request-p/ Share on other sites More sharing options...
MadTechie Posted August 19, 2010 Share Posted August 19, 2010 i assume you mean this, <?php $units_stats_1 = array(40, 35, 50); $units_stats_2 = array( $units_stats_1[0] * (1+(50/100)), $units_stats_1[1] * (1+(100/100)), $units_stats_1[2] * (1+(100/100))); echo $units_stats_2[0]."<BR />\n"; echo $units_stats_2[1]."<BR />\n"; echo $units_stats_2[2]."<BR />\n"; ?> remove the 1+ if you do mean (40 x 50%) that = 20 and the 35 and 50 would remain unchanged Quote Link to comment https://forums.phpfreaks.com/topic/211151-php-array-with-help-request-p/#findComment-1101130 Share on other sites More sharing options...
lasse48 Posted August 19, 2010 Author Share Posted August 19, 2010 thanks alot MadTechie , it worked like i wanted it to do now with your help Quote Link to comment https://forums.phpfreaks.com/topic/211151-php-array-with-help-request-p/#findComment-1101131 Share on other sites More sharing options...
MadTechie Posted August 19, 2010 Share Posted August 19, 2010 Your welcome, of course the 100/100 can be replaced with 1 (well 2 if you also remove the +1) i just added to make it clear.. if this is solved can you click solved (bottom left) --MadTechie Quote Link to comment https://forums.phpfreaks.com/topic/211151-php-array-with-help-request-p/#findComment-1101134 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.