How to get value of array inside another array in php?

I made a php page in which I got the array within array value.

Here is my array:

Array (
  [events] => Array ( [0] => 5 [1] => 7 [2] => 8 )
  [fromdate] =>
  [todate] =>
  [description] =>
  [subject] =>
  [fromname] =>
  [replyto] =>
  [senddatetime] =>
  [timezone] => America/Los_Angeles
  [message] =>
  [submit_skip] => Continue
)

This array is the POST data from previous page. I want to get events value in a variable. How can I do this?

I use this for getting events value but it gives me the array but I want to get first event value

echo $eventid=$_POST['events'];

Answers


To echo:

echo $_POST['events'][0];

To assign it to a variable:

$eventid = $_POST['events'][0];

To assign the array to a variable and get the value from the new array:

$events = $_POST['events'];
$eventid = $events[0];

[0] represents the key of the first value since it is set to be 0.


Output:

echo $_POST['events'][0];

Assign to variable:

$eventid = $_POST['events'][0];

Need Your Help

Draw text along the bezier curve in paper.js

javascript html5 canvas paperjs

Is it possible to easily draw text along the bezier curve using paper.js?

Dot Product from Two Vectors as Float?

java vector

is there an existing function in java where i can get the dot product of two Vectors? Like: