eatc7402 Posted February 20, 2007 Share Posted February 20, 2007 I feel dumb. I've been having a problem getting informatin OUT of an ' multi-dimensioned array. Research shows many examples thst seem to use the symbols '=>' as some type of assignment (I think) but I cannot seem to locate an explanation of what and how the => is for and how exactly it is used. I could use a steer. Now for my array problem. I have a five row array. Each row has 20 columns in it - titled with text, so I guess I have an 'associative' array. A print_r of the array indicates it is organized exactly I would expect it to be. I am trying to get a SINGLE CELL value assigned to variable as in $cell_value=$my_array[1]['some_cell']; , however this does seem to result in the value I can SEE in the print_r cell for that (row1) value being assigned to the variable. Dunno what I am doing wrong. BTW I can do a printF on the same $my_array[1]['some_cell'] cell and it does show the right value. I just don't seem to be able to ASSIGN it to something else. eatc7402 Link to comment https://forums.phpfreaks.com/topic/39371-what-the-heck-is-as-an-operator-in-arrays/ Share on other sites More sharing options...
richardw Posted February 20, 2007 Share Posted February 20, 2007 the ">=" is the mathematical term for greater than or equal to. I hope this helps you put your project in the proper perspective best Link to comment https://forums.phpfreaks.com/topic/39371-what-the-heck-is-as-an-operator-in-arrays/#findComment-189917 Share on other sites More sharing options...
Guest Posted February 20, 2007 Share Posted February 20, 2007 The => operator give a value a "name" There are two kinds of arrays. Associative arrays and numerical arrays. Here is a numerical array: <?php $num_array = array('happy', 'sad', 'coy'); echo $num_array[0]; // happy echo $num_array[1]; // sad echo $num_array[2]; // coy ?> Here is an associative array: <?php $assoc_array = array('first' => 'happy', 'second' => 'sad', 'third' => 'coy'); echo $assoc_array['first']; // happy echo $assoc_array['second']; // sad echo $assoc_array['third']; // coy ?> Do you see what I mean? Link to comment https://forums.phpfreaks.com/topic/39371-what-the-heck-is-as-an-operator-in-arrays/#findComment-189919 Share on other sites More sharing options...
hvle Posted February 20, 2007 Share Posted February 20, 2007 yes, there is no operator reference to => because it is not an operator. It is a directive, and you already know how to use it. what's wrong when you doing this: $cell_value=$my_array[1]['some_cell']; Link to comment https://forums.phpfreaks.com/topic/39371-what-the-heck-is-as-an-operator-in-arrays/#findComment-189920 Share on other sites More sharing options...
eatc7402 Posted February 21, 2007 Author Share Posted February 21, 2007 $cell_value=$my_array[1]['some_cell']; $cell_value is blank (apparently not being assigned a value at least an echo() of it show nothing, and using $cell_value in a <td> cell outputs no value either. eatc7402 Link to comment https://forums.phpfreaks.com/topic/39371-what-the-heck-is-as-an-operator-in-arrays/#findComment-189964 Share on other sites More sharing options...
Jessica Posted February 21, 2007 Share Posted February 21, 2007 Can you paste the result of your print_r() here? (in the code tags please) Link to comment https://forums.phpfreaks.com/topic/39371-what-the-heck-is-as-an-operator-in-arrays/#findComment-189965 Share on other sites More sharing options...
eatc7402 Posted February 21, 2007 Author Share Posted February 21, 2007 I believe the extract() function is what I needed. Just discovered it. All the index names are the datatable column names and extract() fills in the variables automatically.... just what I needed. http://www.hudzilla.org/phpbook/read.php/5_0_0 This url I discovered really helped me work through through this problem. eatc7402 Link to comment https://forums.phpfreaks.com/topic/39371-what-the-heck-is-as-an-operator-in-arrays/#findComment-189980 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.