Jump to content

[SOLVED] Arrays


Ken2k7

Recommended Posts

Almost all forum scripts have some sort of lang.php which holds an array with output lines.

 

$arr = array();

$arr = array(
'SOMETHING'  =>   "SOMETHING ELSE",
'SOMETHING 1'    =>   "SOMETHING ELSE 1",
.
.
.
);

?>

 

My question is how does => work and if I plan to use something like this too, how would I go about getting the values?

 

Thanks in advance,

Ken

Link to comment
Share on other sites

Thanks Daniel.

 

Final question on this matter: can I use a loop for this?

 

Edit: okay read the link you placed up Daniel. Question now is: can you explain what the => does in this? And what does $array as $i mean?

<?php

foreach ($array as $i => $value) {
    unset($array[$i]);
}

?>

Link to comment
Share on other sites

Oh okay.

 

Just making sure on one thing here.

 

So rather than having a key, can I use the foreach loop as such:

<?php 
foreach ($array as $i) {
    unset($array[$i]);
}
?>

 

Unless the $value plays a special role in that foreach loop :S Which I have no idea what it does. :(

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.