Table of Contents
The array_column() function written by myself is compatible with versions lower than PHP 5.5, 5.5array_column
What is the latest version of apache currently? Compatible with php536 and mysql 55117
How can the cms system be compatible with various versions of php (40 or 50) servers?
Home Backend Development PHP Tutorial The array_column() function I wrote myself that is compatible with versions lower than PHP 5.5, 5.5array_column_PHP tutorial

The array_column() function I wrote myself that is compatible with versions lower than PHP 5.5, 5.5array_column_PHP tutorial

Jul 13, 2016 am 10:16 AM
array cms system compatible

The array_column() function written by myself is compatible with versions lower than PHP 5.5, 5.5array_column

array_column is used to obtain elements in a two-dimensional array (new function in PHP 5.5), but we sometimes need to use it in a lower version of PHP environment...

if( ! function_exists('array_column'))
{
  function array_column($input, $columnKey, $indexKey = NULL)
  {
    $columnKeyIsNumber = (is_numeric($columnKey)) ? TRUE : FALSE;
    $indexKeyIsNull = (is_null($indexKey)) ? TRUE : FALSE;
    $indexKeyIsNumber = (is_numeric($indexKey)) ? TRUE : FALSE;
    $result = array();

    foreach ((array)$input AS $key => $row)
    { 
      if ($columnKeyIsNumber)
      {
        $tmp = array_slice($row, $columnKey, 1);
        $tmp = (is_array($tmp) && !empty($tmp)) ? current($tmp) : NULL;
      }
      else
      {
        $tmp = isset($row[$columnKey]) ? $row[$columnKey] : NULL;
      }
      if ( ! $indexKeyIsNull)
      {
        if ($indexKeyIsNumber)
        {
          $key = array_slice($row, $indexKey, 1);
          $key = (is_array($key) && ! empty($key)) ? current($key) : NULL;
          $key = is_null($key) ? 0 : $key;
        }
        else
        {
          $key = isset($row[$indexKey]) ? $row[$indexKey] : 0;
        }
      }

      $result[$key] = $tmp;
    }

    return $result;
  }
}
Copy after login

What is the latest version of apache currently? Compatible with php536 and mysql 55117

The following are the installation steps I found online. I have never configured it under apache.
If you don’t want to bother, you can download a ready-made component, such as PHPnow, which integrates apache+php+mysql+Zend Optimizer+eAccelerator Everything that needs to be configured is integrated, just install it
Of course it is 2003

How can the cms system be compatible with various versions of php (40 or 50) servers?

To be able to run on both php4 and php5, you need to have a version judgment function

You can do this:
if (version_compare( phpversion(), ' 5', '<' ) )
include_once( 'php4.php' ) ;//php4 related configuration files or calling functions
else
include_once( 'php5.php' ) ;//php5 Related files or calling functions
}
In this way, in different environments, you can call different files to realize your functions, but the specific implementation is much more complicated.
Hope it helps you

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/899062.htmlTechArticleWritten by myself, the array_column() function is compatible with versions lower than PHP 5.5. 5.5array_column array_column is used to obtain a two-dimensional array. Elements in (new function in PHP 5.5), but sometimes we need to lower...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use Python to implement the file management function of CMS system How to use Python to implement the file management function of CMS system Aug 07, 2023 am 09:18 AM

How to use Python to implement the file management function of a CMS system. With the development of the Internet, content management systems (CMS) play an important role in website development. As part of it, the file management function is an important part of supporting the CMS system. This article will introduce how to use Python language to implement the file management function of CMS system. 1. Requirements analysis of the file management function Before implementing the file management function, we need to conduct a needs analysis first. The file management function mainly includes the following needs:

The most stable version of Win10 The most stable version of Win10 Dec 25, 2023 pm 07:58 PM

Many users will encounter freezes or blue screens when operating the computer. At this time, we need to find the most stable win10 version to operate. Overall, it is very easy to use and can make your daily use smoother. The most stable win10 version in history 1. Win10 genuine original system. Here users can use simple operations. The system has been optimized and has strong stability, security and compatibility. Users can follow the steps to achieve the perfect machine. 2. Russian master streamlined The version of win10 has been strictly streamlined and many unnecessary functions and services have been deleted. After streamlining, the system has lower CPU and memory usage and runs faster. 3. Win10 Lite Edition 1909 is installed on multiple computers with different hardware models.

How to use Java to implement the content review function of CMS system How to use Java to implement the content review function of CMS system Aug 26, 2023 pm 12:51 PM

How to use Java to implement the content audit function of a CMS system. With the booming development of the Internet, content management systems (CMS) play an important role in website and application development. In order to ensure the quality and safety of website or application content, content review has become an indispensable function. This article will introduce how to use Java to implement the content review function of the CMS system and provide corresponding code examples. Understanding the Need for Content Moderation Before we start writing code, we first need to understand the need for content moderation. Generally speaking, content moderation can

Sort array using Array.Sort function in C# Sort array using Array.Sort function in C# Nov 18, 2023 am 10:37 AM

Title: Example of using the Array.Sort function to sort an array in C# Text: In C#, array is a commonly used data structure, and it is often necessary to sort the array. C# provides the Array class, which has the Sort method to conveniently sort arrays. This article will demonstrate how to use the Array.Sort function in C# to sort an array and provide specific code examples. First, we need to understand the basic usage of the Array.Sort function. Array.So

How to use Java to implement the traffic statistics function of CMS system How to use Java to implement the traffic statistics function of CMS system Aug 07, 2023 am 10:16 AM

How to use Java to implement the traffic statistics function of the CMS system. The CMS system (content management system) plays an important role in the development of the Internet. As users have higher and higher demands for content, traffic statistics have become one of the essential functions of CMS systems. By counting traffic, it can help website administrators understand website visits and optimize website performance and content. This article will introduce how to use Java language to implement the traffic statistics function of CMS system. First, we need to understand the principles of traffic statistics. Simple

Is Switch2 compatible with Switch cartridges? Is Switch2 compatible with Switch cartridges? Jan 28, 2024 am 09:06 AM

Switch2 is a new model announced by Nintendo at Gamescom 2023. Some players are worried about whether there will be compatibility issues between the new model and the cartridges of previous versions. Let’s take a look. Is switch2 compatible with switch cassette? Answer: switch2 is not compatible with switch cassette. Introduction of Switch 2 cartridges According to information from Nintendo’s production chain company, Switch 2 may use 64GB cartridges. Because it has better performance and supports more 3A game masterpieces, it requires a larger cartridge capacity. Because many game works need to be castrated and compressed before they can be stuffed into a game cartridge. Moreover, Switch cartridges are prone to copying game content, so replace them with new cartridges.

How to use Java to implement the custom form function of CMS system How to use Java to implement the custom form function of CMS system Aug 09, 2023 am 08:29 AM

How to use Java to implement the custom form function of a CMS system Summary: With the development of information technology, content management systems (CMS) have become an important part of website construction. The custom form function is an important function in the CMS system, which can realize data collection and display on user-defined pages. This article will introduce how to use Java to write code to implement the custom form function of the CMS system, and provide relevant code examples for readers' reference. 1. Overview The custom form function is an important part of the CMS system. It can

Does Win11 support dynamic wallpapers? Does Win11 support dynamic wallpapers? Jan 01, 2024 pm 06:41 PM

As we all know, a major feature of win11 is its own Android subsystem, which allows us to install Android software without using an emulator. However, there is also the problem of win11 Android application lag. How should this be solved? Is win11 not compatible with dynamic wallpapers? Answer: Win11 is compatible with dynamic wallpapers. If it cannot be used, it may be because the software or system version is lagging behind. If it was just updated, it may be covered by the system wallpaper. 1. If the system or software version is lagging behind, just update the system and dynamic wallpaper software. 2. If it is covered by the system wallpaper, you can try to open "Settings" 3. Then enter the "Background" settings under "Personalization". 4. Then change the personalized background to "Picture" 5. After the modification is completed, you can set the dynamic wallpaper normally

See all articles