dubc07 Posted July 17, 2008 Share Posted July 17, 2008 I'm wanting to put the following into variables. $content = array( "html" => "<b>$name</b><br>Solo", // Display 'Phsychology: Room 404' "style" => "background-color: $color", // use style property to change the background color "interval" => $intrv // set the interval for 2hrs ); $tilt = array($time =>$content); $edz = ''.$plane.' =>'; $lst =")),"; ////to close the array/// having the most problems here. $first = $edz.$tilt.$lst; echo $first; //the end results should look like this 0 => array( // Adds a class at 11am (1100 hours) 700 => array( "html" => "<b>Airplane Down </b><br>Maintenance", // Display 'English 101: Room 235' "style" => "background-color: #FFFFFF", // use style property to change the background color "interval" => 1400 // set the interval for 2hrs ) ), ////im wanting to put the array into a variable so that i can put the output as $first//// $classes_arr = array($first); Quote Link to comment https://forums.phpfreaks.com/topic/115286-pieces-of-array-into-variable/ Share on other sites More sharing options...
dubc07 Posted July 17, 2008 Author Share Posted July 17, 2008 I'm wanting to put the following into variables. $content = array( "html" => "<b>$name</b><br>Solo", // Display 'Phsychology: Room 404' "style" => "background-color: $color", // use style property to change the background color "interval" => $intrv // set the interval for 2hrs ); $tilt = array($time =>$content); $edz = ''.$plane.' =>'; $lst =")),"; ////to close the array/// having the most problems here. $first = $edz.$tilt.$lst; echo $first; //the end results should look like this 0 => array( // Adds a class at 11am (1100 hours) 700 => array( "html" => "<b>Airplane Down </b><br>Maintenance", // Display 'English 101: Room 235' "style" => "background-color: #FFFFFF", // use style property to change the background color "interval" => 1400 // set the interval for 2hrs ) ), ////im wanting to put the array into a variable so that i can put the output as $first//// $classes_arr = array($first); Quote Link to comment https://forums.phpfreaks.com/topic/115286-pieces-of-array-into-variable/#findComment-592713 Share on other sites More sharing options...
wildteen88 Posted July 17, 2008 Share Posted July 17, 2008 You need to learn the proper syntax for arrays. I guess you mean: $content = array( "html" => "<b>$name</b><br>Solo", // Display 'Phsychology: Room 404' "style" => "background-color: $color", // use style property to change the background color "interval" => $intrv // set the interval for 2hrs ); $time = 700; $array[][$time] = $content; //or $array = array(0 => array($time => $content)); Quote Link to comment https://forums.phpfreaks.com/topic/115286-pieces-of-array-into-variable/#findComment-592841 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.