Getting started with PHPVariablesArraysFunctional ProgrammingTypesAutoloading PrimerException Handling and Error ReportingWorking with Dates and TimeSending EmailSessionsCookiesClasses and ObjectsPassword Hashing FunctionsOutput BufferingJSONSOAP ClientReflectionUsing cURL in PHPDependency InjectionXMLRegular Expressions (regexp/PCRE)TraitsNamespacesParsing HTMLComposer Dependency ManagerMagic MethodsAlternative Syntax for Control StructuresFile handlingMagic ConstantsType hintingMulti Threading ExtensionFilters & Filter FunctionsGeneratorsOperatorsConstantsUTF-8URLsObject SerializationPHPDocContributing to the PHP ManualString ParsingLoopsControl StructuresSerializationClosureReading Request DataType juggling and Non-Strict Comparison IssuesSecurityPHP MySQLiCommand Line Interface (CLI)LocalizationDebuggingSuperglobal Variables PHPUnit TestingVariable ScopeReferencesCompilation of Errors and WarningsInstalling a PHP environment on WindowsDatetime ClassHeaders ManipulationPerformanceCommon ErrorsInstalling on Linux/Unix EnvironmentsContributing to the PHP CoreCoding ConventionsUsing MongoDBAsynchronous programmingUsing SQLSRVUnicode Support in PHPFunctionsCreate PDF files in PHPHow to Detect Client IP AddressYAML in PHPImage Processing with GDMultiprocessingSOAP ServerMachine learningCacheStreamsArray iterationCryptographyPDOSQLite3SocketsOutputting the Value of a VariableString formattingCompile PHP Extensionsmongo-phpManipulating an ArrayExecuting Upon an ArrayProcessing Multiple Arrays TogetherSPL data structuresCommentsIMAPUsing Redis with PHPImagickSimpleXMLHTTP AuthenticationRecipesBC Math (Binary Calculator)Docker deploymentWebSocketsAPCuDesign PatternsSecure Remeber Mephp mysqli affected rows returns 0 when it should return a positive integerPHP Built in serverHow to break down an URLPSR

Compilation of Errors and Warnings

Other topics

Notice: Undefined index

Appearance :

Trying to access an array by a key that does not exist in the array

Possible Solution :

Check the availability before accessing it. Use:

  1. isset()
  2. array_key_exists()

Warning: Cannot modify header information - headers already sent

Appearance :

Happens when your script tries to send a HTTP header to the client but there already was output before, which resulted in headers to be already sent to the client.

Possible Causes :

  1. Print, echo: Output from print and echo statements will terminate the opportunity to send HTTP headers. The application flow must be restructured to avoid that.

  2. Raw HTML areas: Unparsed HTML sections in a .php file are direct output as well. Script conditions that will trigger a header() call must be noted before any raw blocks.

    <!DOCTYPE html>
    <?php
         // Too late for headers already.
    
  3. Whitespace before <?php for "script.php line 1" warnings: If the warning refers to output in line 1, then it's mostly leading whitespace, text or HTML before the opening <?php token.

    <?php
    # There's a SINGLE space/newline before <? - Which already seals it.
    

Reference from SO answer by Mario

Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM

Appearance:

"Paamayim Nekudotayim" means "double colon" in Hebrew; thus this error refers to the inappropriate use of the double colon operator (::). The error is typically caused by an attempt to call a static method that is, in fact, not static.

Possible Solution:

$classname::doMethod();

If the above code causes this error, you most likely need to simply change the way you call the method:

$classname->doMethod();

The latter example assumes that $classname is an instance of a class, and the doMethod() is not a static method of that class.

Contributors

Topic Id: 3509

Example Ids: 12099,12101,26380

This site is not affiliated with any of the contributors.