Welcome Guest, Not a member yet? Register   Sign In
Need Help
#1

[eluser]phpfresher[/eluser]
Here is the array: $type = array(
'1' => 'Admin',
'2' => 'Client',
'3' => 'Programmer',
'4' => 'Team Leader',
); And my output is : 2 now i need to disply Client similarly when my output is 4 i need to display Team Leader .. Can u help me out
#2

[eluser]phpfresher[/eluser]
$type = array(
'1' => 'Admin',
'2' => 'Client',
'3' => 'Programmer',
'4' => 'Team Leader',
);
foreach($type as $key=>$val){
if($key=='1' ){
die($val);
}
}
#3

[eluser]InsiteFX[/eluser]
Post your question in the correct forum! This forum is NO CODE! Also use Code Tags!

InsiteFX
#4

[eluser]Nick_MyShuitings[/eluser]
Also, that is simple array traversal, I'd suggest a quick read through of foreach statements, and array functions.

In your case if you have
Code:
$output = 2 //or some other way that a var is set with your output
; somewhere then just use
Code:
echo $type[$output]
and have a nice day.

And yeah, please do read the forum names... they are pretty easy to figure out where to post what.




Theme © iAndrew 2016 - Forum software by © MyBB