Jump to content

Okay I am finally understanding FOREACH!!


Monkuar

Recommended Posts

$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:

 

 

pk5l.png

 

 

 

Now I just want my users to beable to change the order of the Array? how is this possible? :o  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: :shrug: :shrug:

Link to comment
Share on other sites

$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!!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.