Reputation: 39
if ($_POST['op_ep_cat'] == 'op_single_ep')
{
$ep_place = $_POST['the_place'];
$eps_array = array();
array_push($eps_array, $ep_place);
}
else if ($_POST['op_ep_cat'] == 'op_category') {
$cat_site = $_POST['the_place'];
$taken_cat_site = file_get_contents($cat_site);
if (preg_match_all('#<div class="content_ep"><a href="(.+?)"#si', $taken_cat_site, $eps_array));
else if (preg_match_all('#<div class="postlist">\s*<a href="(.+?)"#si', $taken_cat_site, $eps_array));
}
foreach(array_reverse($eps_array[1]) as $eps_match)
{
echo 'Arughh!';
}
The above works for the 'op_category'
perfectly, but not for the 'op_single_ep'
... So basically $ep_place
needs to be apart of the $eps_array[1]
, if possible, somehow.. Hopefully any of this makes sense!
I appreciate any help!
Upvotes: 0
Views: 128
Reputation: 360702
it'd be $eps_array[0]
for the op_single_ep
version. Remember, PHP arrays have 0-based indexes.
Upvotes: 0
Reputation: 5229
try that
$eps_array = array(1 => array($_POST['the_place']));
but whole code is just weird
Upvotes: 1
Reputation: 47620
$eps_array[1]
is not array, is element of $eps_array
You can make array
$eps_array = array(1=>array());
array_push($eps_array[1], $ep_place);
Try to read manual about What is array
Upvotes: 1
Reputation: 7583
Try this
if ($_POST['op_ep_cat'] == 'op_single_ep')
{
$ep_place = $_POST['the_place'];
$eps_array = array();
$eps_array[1] = array();
array_push($eps_array[1], $ep_place);
}
Upvotes: -1