Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9196609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:53:17+00:00 2026-06-17T21:53:17+00:00

I know that you’re supposed to define PHP variables so that you don’t clog

  • 0

I know that you’re supposed to define PHP variables so that you don’t clog up your error log with undefined variables, but my logs are still getting filled with unnecessary information.

For instance…

[28-Jan-2013 16:45:42 UTC] PHP Notice:  Undefined index: site in C:\Sites\FLCBranson.org\freedownloads.php on line 34

My PHP code has $site defined, but I do want to have option to override it…

// it's a good idea to define the variable first and then make changes as necessary (that way you don't fill up your logs with worthless errors)
$site = "flc";
// overrides the domain (useful for IP addresses)
if ($_GET["site"]) $site = $_GET["site"];

So, I have a lot of that type of issue. Then I have a bunch of these pesky errors…

[28-Jan-2013 16:45:42 UTC] PHP Notice:  Undefined offset: 3 in C:\Sites\FLCBranson.org\listseries.php on line 264
[28-Jan-2013 16:45:42 UTC] PHP Notice:  Undefined offset: 4 in C:\Sites\FLCBranson.org\listseries.php on line 265
[28-Jan-2013 16:45:42 UTC] PHP Notice:  Undefined offset: 5 in C:\Sites\FLCBranson.org\listseries.php on line 266

I have an array that is populated with various bits of content. If something is in one of the slots, then I want to do something with it…

// explode() takes a string of text ($item->title in this case) and creates an array comprised of parts of the text separated by the separator (- in this case)
$title = explode(" - ", $sermontitle);
// sets the sermon title variable
$sermontitle = $title[0];
if ($title[1]) $sermontitle = $sermontitle . " - " . $title[1];
if ($title[2]) $sermontitle = $sermontitle . "<br>" . $title[2];
if ($title[3]) $sermontitle = $sermontitle . " - " . $title[3];
if ($title[4]) $sermontitle = $sermontitle . " - " . $title[4];
if ($title[5]) $sermontitle = $sermontitle . " - " . $title[5];

So, what am I doing incorrectly? I define my variable. Then I only make changes to the variable if certain conditions are met. I thought that was the appropriate way of doing it.

Edit…

I found another odd instance…

[28-Jan-2013 20:07:05 UTC] PHP Notice:  Undefined variable: broadcast in C:\Sites\FLCBranson.org\flconlineservices.php on line 242

It seems that if (file_exists($golive) || ($broadcast == "live") isn’t enough. Do I need to do if (file_exists($golive) || (isset($broadcast) && $broadcast == "live"))? That seems like a lot of code to perform a simple comparison.

Edit 2…

So, I’m starting to understand why isset() is required, but here’s something that I don’t get. I have some code pulling information from a database and I have if ($row["Sarasota"]) but the error log doesn’t show a single thing for that. Why wouldn’t isset() be required there if it is required for if ($title[5])? The only difference I can see is the quoted word “Sarasota” as opposed to the unquoted numeric 5.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:53:18+00:00Added an answer on June 17, 2026 at 9:53 pm
    if ($_GET["site"])
    

    must be

    if (isset($_GET["site"]))
    

    And also for the $title things you should use isset:

    if (isset($title[1])) [...]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that WCF is supposed to be transport agnostic, but is there a
i know that you can use themeroller to customize your UI theme but is
I know that I am supposed to use std::vector or other alternatives, but there's
I know that Phonegap has an event for back button, but it's only available
I know that this sort of question has been asked here before, but still
I know that Java have its own garbage collection, but sometimes I want to
I know that this question has been asked quite a few times, but I
I know that question has been repeatedly asked in different ways, but I tried
I know that this question has been asked in various forms but my requirement
I know that Eclipse can create a new serialVersionUID when you don't yet have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.