Monkuar Posted February 9, 2012 Share Posted February 9, 2012 $middle=array( "aboutme" => $aboutme, "signature" => $signature, "friends" => $f, ); foreach ($middle as $val =>$n) { $middlesection .= $middle[$val]; var_dump($middle[$val]); } Okay now How do I make this so my users can choose the ORDER of there profile sections? I: have a field in my db called "profile" varchar 255!I am so excited I am actually learning Foreach with arrays this is awesome! I am echoing out my $middlesection to display my 3sections: here is a screenshot: Now I just want my users to beable to change the order of the Array? how is this possible? I am so close, eventually I want them to beable to move the sections to the left or right (I would need a 3d array though) im not that smart yet :shrug: :shrug: Quote Link to comment https://forums.phpfreaks.com/topic/256716-okay-i-am-finally-understanding-foreach/ Share on other sites More sharing options...
Monkuar Posted February 9, 2012 Author Share Posted February 9, 2012 $middle=array( "0" => $aboutme, "1" => $signature, "2" => $f, ); $order = array(1,2,0); print_r($middle); foreach ($order as $index) { $middlesection.= $middle[$index]; } LOL I FIGURED IT OUT!! AWESOME MAN LOVE IT THANKS!!!!! FOREACH IS JUST FREAKING EPCI!! Quote Link to comment https://forums.phpfreaks.com/topic/256716-okay-i-am-finally-understanding-foreach/#findComment-1316049 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.