• Advertisement
Sign in to follow this  

[web] PHP problem - logical code isn't working...

This topic is 4799 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey everyone, I have been trying to get this to work for ever and I'm totally stuck. Here's my code below
$pgdesc_track = ($pgdesc_track + 1);
$pgdesc[$pgdesc_track2] = str_replace("<DRS::DATETIME>", "date test", $pgdesc[$pgdesc_track]);
$pgdesc_track2 = ($pgdesc_track2 + 1);
echo "$pgdesc_track<br />";
echo "$pgdesc_track2<br />";
echo "$pgdesc[$pgdesc_track2]";

It won't display $pgdesc[$pgdesc_track2] after I go thorugh the str_replace function. Can someone please point out to me what I'm doing wrong? I'm sure it's somthing simple but I just can't see it. Any help is appreciated.

Share this post


Link to post
Share on other sites
Advertisement
echo "$pgdesc[$pgdesc_track2]";

should be

echo $pgdesc[$pgdesc_track2];

I think. That's because PHP assumes quotes around the array field when inside a string. When readinging your echo string it interprets it as $pgdesc["$pgdesc_track2"] which doesn't exist and therefor returns empty.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement