alconebay Posted July 8, 2009 Share Posted July 8, 2009 I just starting using arrays and I don't understand why this is not working: if ($user['gender']=="m") {$user['gender']=="Male";} I'm using that if statement (and an else statement for "Female". Not shown) in a loop and the statement is being read but "$user['gender']" still outputs "m" instead of "Male". Link to comment https://forums.phpfreaks.com/topic/165197-solved-redefining-a-variable-in-an-array/ Share on other sites More sharing options...
p2grace Posted July 8, 2009 Share Posted July 8, 2009 An assignment only uses one equal sign. if ($user['gender']=="m") {$user['gender']="Male";} Link to comment https://forums.phpfreaks.com/topic/165197-solved-redefining-a-variable-in-an-array/#findComment-871092 Share on other sites More sharing options...
alconebay Posted July 8, 2009 Author Share Posted July 8, 2009 oops. I feel stupid. Thanks Link to comment https://forums.phpfreaks.com/topic/165197-solved-redefining-a-variable-in-an-array/#findComment-871118 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.