Hi is there a way to count active and print active session starting with a specific string?
For example, I want to count session that has a name starting with "question"
Hi is there a way to count active and print active session starting with a specific string?
For example, I want to count session that has a name starting with "question"
Assuming that we are using the $_SESSION
array and the names are done similar to:
$_SESSION["question1"] = "foo";
$_SESSION["question2"] = "bar";
...
Loop through the array and check if "question"
is inside each string by using strstr()
:
foreach ($_SESSION as $key => $value)
if(strstr($key, "question"))
print $value;