Jump to content

Recommended Posts

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);

Link to comment
https://forums.phpfreaks.com/topic/115286-pieces-of-array-into-variable/
Share on other sites

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);

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));

 

 

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.