markdown AVNLIPPP - 流行的PHP项目中的平均变量名称长度

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown AVNLIPPP - 流行的PHP项目中的平均变量名称长度相关的知识,希望对你有一定的参考价值。

#!/usr/bin/env bash

set -o errexit  # Exit script when a command exits with non-zero status.
set -o errtrace # Exit on error inside any functions or sub-shells.
set -o nounset  # Exit script on use of an undefined variable.
set -o pipefail # Return exit status of the last command in the pipe that exited with a non-zero exit code

: readonly "${GRAPH_URL:=https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=%s+PHP+variable+name+length&chd=t:0,%s}"
# : readonly "${NORMAL_OUTPUT:=/dev/stdout}"
: readonly "${NORMAL_OUTPUT:=/dev/null}"
: readonly "${WORKING_DIRECTORY:=$PWD}"
: readonly "${ACK:=ack-grep}"

variable-names-length-per-php-project() {

    calculate-average() {
        local -a aScoreList
        local -i iAverage=0 iCount iIndex iTotal=0 iTotalCount=0
        local sScoreList

        readonly sScoreList="${1?One parameter required: <score-list>}"
        readonly aScoreList=( ${sScoreList//,/ } )

        for iIndex in "${!aScoreList[@]}"; do
            iCount="${aScoreList[${iIndex}]}"
            if [[ "${iCount}" -ne 0 ]];then
                iTotal=$(( iTotal + $((iCount * $((iIndex+1))))))
            fi
            iTotalCount=$(( iTotalCount + iCount ))
        done

        if [[ ${iTotalCount} -gt 0 ]];then
            iAverage=$(( iTotal / iTotalCount ));
        fi

        echo "${iAverage}"
    }

    calculate-minimum() {
        local -a aScoreList
        local -i iIndex iMinimum=0
        local sScoreList

        readonly sScoreList="${1?One parameter required: <score-list>}"
        readonly aScoreList=( ${sScoreList//,/ } )

        for iIndex in "${!aScoreList[@]}"; do
            if [[ "${aScoreList[${iIndex}]}" -ne 0 ]];then
                readonly iMinimum=$((iIndex + 1))
                break
            fi
        done

        echo "${iMinimum}";
    }

    calculate-maximum() {
        local -a aScoreList
        local -i iIndex iMaximum=0
        local sScoreList

        readonly sScoreList="${1?One parameter required: <score-list>}"
        readonly aScoreList=( ${sScoreList//,/ } )

        for iIndex in "${!aScoreList[@]}"; do
            if [[ "${aScoreList[${iIndex}]}" -ne 0 ]];then
                iMaximum=$((iIndex + 1))
            fi
        done

        echo "${iMaximum}";
    }

    clear-line() {
        tput cuu 1 && tput el
    }

    create-variables-list() {
        local -i iCounter iResult
        local sDirectory sPattern sResult=''

        readonly sDirectory="${1?One parameter required: <directory-to-scan>}"

        for iCounter in {1..50};do
            sPattern='\$[a-zA-Z0-9_]{'${iCounter}'}\b';
            iResult="$(create-ack-list "${sPattern}" "${sDirectory}" | wc -l)"
            sResult+="${iResult},"
        done

        # Remove trailing comma
        echo "${sResult:0:-1}"
    }

    create-ack-list() {
        local sDirectory sPattern

        readonly sPattern="${1?Two parameters required: <ack-pattern> <directory-to-scan>}"
        readonly sDirectory="${2?Two parameters required: <ack-pattern> <directory-to-scan>}"

        { "${ACK}" \
            --php \
            --ignore-file='match:/^.*(\.phar|Test.php)$/' \
            --match "${sPattern}" \
            -o \
            --ignore-dir=vendor --ignore-dir=var \
            "${sDirectory}" \
            | cut -d ':' -f 3 \
            | sort -u
        } || echo -n ''
    }

    fetch-github-list() {
        curl -s 'https://api.github.com/search/repositories?q=language%3APHP&sort=stars&language=php' \
            | grep 'clone_url' \
            | cut -d'"' -f4
    }

    print-topic() {
        echo -e " =====> $*\n" >> "${NORMAL_OUTPUT}"
    }

    print-status() {
        echo -e " -----> $*\n" >> "${NORMAL_OUTPUT}"
    }

    main() {
        local -a aProjects
        local sDetailResult sDirectory sFile sImagesUrl sProject sResult sSummaryResult sUrl

        mkdir -p "${WORKING_DIRECTORY}/build/"

        if [[ ! -f "${WORKING_DIRECTORY}/github.log" ]];then
            print-topic 'Fetching project list from Github'
            echo "$(fetch-github-list)" > "${WORKING_DIRECTORY}/github.log"
        fi

        readonly aProjects=( $(cat "${WORKING_DIRECTORY}/github.log" ) )

        for sUrl in "${aProjects[@]}";do
            print-topic 'Processing project list'

            sProject="$(echo "${sUrl:19:-4}" | tr '/' '_')"
            sDirectory="${WORKING_DIRECTORY}/${sProject}"

            if [[ "${sProject}" = '' ]];then
                echo " ! ERROR"
                exit 90
            fi

            if [[ ! -f "${WORKING_DIRECTORY}/build/${sProject}.txt" ]];then

                if [[ ! -d "${WORKING_DIRECTORY}/${sProject}" ]];then
                    print-status "Cloning ${sUrl}"
                    git clone ${sUrl} "${WORKING_DIRECTORY}/${sProject}"
                fi

                print-status "Creating list of variables for ${sProject}"
                echo "$(create-variables-list "${sDirectory}")" > "${WORKING_DIRECTORY}/build/${sProject}.txt"

                if [[ -d "${WORKING_DIRECTORY}/${sProject}" ]];then
                    rm -rdf "${WORKING_DIRECTORY}/${sProject}"
                fi
            fi
        done

        sSummaryResult=''
        sDetailResult=''

        for sFile in "${WORKING_DIRECTORY}/build/"*".txt";do
            sProject="$(basename ${sFile:0:-4} | tr '_' '/')"
            sResult="$(cat ${sFile})"

            iAverage=$(calculate-average "${sResult}")
            iMin=$(calculate-minimum "${sResult}")
            iMax=$(calculate-maximum "${sResult}")

            sImagesUrl="$(printf "${GRAPH_URL}" "${sProject}" "${sResult}")"

            # sSummaryResult+="$(printf '%2i (min:%2i | max:%2i) %s' "${iAverage}" "${iMin}" "${iMax}" "${sProject}")\n"
            sSummaryResult+="$(printf '| %2i | %2i | %2i | [%s](https://github.com/%s) |' "${iAverage}" "${iMin}" "${iMax}" "${sProject}" "${sProject}")\n"

            # if [[ ! -f "${WORKING_DIRECTORY}/build/${sProject}.png" ]];then
            #     print-status "Downloading graph image for ${sProject}"
            #     wget --quiet --output-document="${WORKING_DIRECTORY}/${sProject}.png" "${sImagesUrl}"
            # fi

            sDetailResult+="$(
                printf '\n\n### %s\n\n![](%s)\n\n- Average:  %2i\n- Shortest: %2i\n- Longest:  %2i\n' \
                    "${sProject}" "${sImagesUrl}" "${iAverage}" "${iMin}" "${iMax}"
            )"
        done

        # echo -e "${sSummaryResult}" | sort -bdf -k1,1nr -k5,5

        echo '| Average | Shortest | Longest | Project |'
        echo '| --- | --- | --- | ---|'
        echo -e "${sSummaryResult}" | sort -t'|' -bdf -k2,2nr -k6,6nr
        echo -e "${sDetailResult}"
    }

    main "${@}"
}

if [[ ${BASH_SOURCE[0]} != $0 ]]; then
    export -f variable-names-length-per-php-project
else
    variable-names-length-per-php-project "${@}"
    exit ${?}
fi

# EOF
# AVNLIPPP
> Average variable name length in popular PHP projects

## Introduction

This project show the average length of [variable](http://php.net/manual/en/language.variables.php)
names of [the Top 30 (by ammount of stars) PHP projects on Github](https://github.com/search?l=php&q=language%3APHP&s=stars&type=Repositories).

The logic that is used to retrieve these values has been included as [a separate shell script](variable-names-length-per-php-project.sh).

## Result

| Average | Shortest | Longest | Project                                                    |
| ------- | -------- | ------- | -----------------------------------------------------------|
| 12 |  1 | 48 | [matomo-org/matomo](https://github.com/matomo-org/matomo)                  |
| 11 |  1 | 49 | [WordPress/WordPress](https://github.com/WordPress/WordPress)              |
| 10 |  1 | 27 | [octobercms/october](https://github.com/octobercms/october)                |
| 10 |  1 | 29 | [composer/composer](https://github.com/composer/composer)                  |
| 10 |  1 | 35 | [phacility/phabricator](https://github.com/phacility/phabricator)          |
| 10 |  1 | 39 | [yiisoft/yii2](https://github.com/yiisoft/yii2)                            |
| 10 |  1 | 41 | [symfony/symfony](https://github.com/symfony/symfony)                      |
| 10 |  1 | 47 | [sebastianbergmann/phpunit](https://github.com/sebastianbergmann/phpunit)  |
|  9 |  1 | 29 | [CachetHQ/Cachet](https://github.com/CachetHQ/Cachet)                      |
|  9 |  1 | 32 | [PHPOffice/PHPExcel](https://github.com/PHPOffice/PHPExcel)                |
|  9 |  1 | 36 | [fzaninotto/Faker](https://github.com/fzaninotto/Faker)                    |
|  9 |  1 | 38 | [getgrav/grav](https://github.com/getgrav/grav)                            |
|  8 |  1 | 23 | [bcit-ci/CodeIgniter](https://github.com/bcit-ci/CodeIgniter)              |
|  8 |  1 | 23 | [slimphp/Slim](https://github.com/slimphp/Slim)                            |
|  8 |  1 | 26 | [Seldaek/monolog](https://github.com/Seldaek/monolog)                      |
|  8 |  1 | 26 | [dingo/api](https://github.com/dingo/api)                                  |
|  8 |  1 | 34 | [cakephp/cakephp](https://github.com/cakephp/cakephp)                      |
|  8 |  1 | 36 | [laravel/framework](https://github.com/laravel/framework)                  |
|  8 |  3 | 19 | [serbanghita/Mobile-Detect](https://github.com/serbanghita/Mobile-Detect)  |
|  7 |  1 | 15 | [domnikl/DesignPatternsPHP](https://github.com/domnikl/DesignPatternsPHP)  |
|  7 |  1 | 23 | [barryvdh/laravel-debugbar](https://github.com/barryvdh/laravel-debugbar)  |
|  7 |  1 | 23 | [guzzle/guzzle](https://github.com/guzzle/guzzle)                          |
|  7 |  1 | 23 | [phalcon/cphalcon](https://github.com/phalcon/cphalcon)                    |
|  7 |  1 | 26 | [phanan/koel](https://github.com/phanan/koel)                              |
|  7 |  1 | 28 | [PHPMailer/PHPMailer](https://github.com/PHPMailer/PHPMailer)              |
|  6 |  1 | 17 | [briannesbitt/Carbon](https://github.com/briannesbitt/Carbon)              |
|  6 |  1 | 17 | [roots/sage](https://github.com/roots/sage)                                |
|  6 |  2 | 16 | [laravel/laravel](https://github.com/laravel/laravel)                      |
|  5 |  1 | 20 | [danielmiessler/SecLists](https://github.com/danielmiessler/SecLists)      |
|  0 |  0 |  0 | [flarum/flarum](https://github.com/flarum/flarum)                          |

### CachetHQ/Cachet

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=CachetHQ/Cachet+PHP+variable+name+length&chd=t:0,8,2,17,30,41,49,41,35,25,37,26,29,27,19,16,9,5,9,4,5,4,4,2,1,0,0,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   9
- Shortest:  1
- Longest:  29

### PHPMailer/PHPMailer

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=PHPMailer/PHPMailer+PHP+variable+name+length&chd=t:0,5,5,22,44,29,30,43,47,35,15,22,13,17,9,4,2,5,1,3,2,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   7
- Shortest:  1
- Longest:  28

### PHPOffice/PHPExcel

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=PHPOffice/PHPExcel+PHP+variable+name+length&chd=t:0,52,170,131,194,231,300,302,320,341,308,272,249,186,184,128,119,91,69,46,26,21,15,14,7,5,3,8,3,1,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   9
- Shortest:  1
- Longest:  32

### Seldaek/monolog

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=Seldaek/monolog+PHP+variable+name+length&chd=t:0,6,10,20,31,34,35,35,39,40,29,19,14,18,14,10,4,6,9,6,5,4,2,0,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   8
- Shortest:  1
- Longest:  26

### WordPress/WordPress

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=WordPress/WordPress+PHP+variable+name+length&chd=t:0,39,143,175,309,351,436,556,744,798,754,728,704,664,494,402,345,296,235,191,165,136,99,68,55,35,31,28,23,13,16,10,8,5,3,8,4,7,0,1,0,1,1,0,0,6,1,0,0,1,0)

- Average:  11
- Shortest:  1
- Longest:  49

### barryvdh/laravel-debugbar

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=barryvdh/laravel-debugbar+PHP+variable+name+length&chd=t:0,12,4,14,27,31,29,31,26,13,16,8,4,8,8,4,1,2,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   7
- Shortest:  1
- Longest:  23

### bcit-ci/CodeIgniter

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=bcit-ci/CodeIgniter+PHP+variable+name+length&chd=t:0,24,51,90,105,116,113,126,149,130,121,99,94,75,44,37,31,15,21,6,10,3,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   8
- Shortest:  1
- Longest:  23

### briannesbitt/Carbon

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=briannesbitt/Carbon+PHP+variable+name+length&chd=t:0,3,4,13,19,19,13,15,12,6,6,4,5,1,3,0,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   6
- Shortest:  1
- Longest:  17

### cakephp/cakephp

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=cakephp/cakephp+PHP+variable+name+length&chd=t:0,19,29,79,171,198,245,270,301,248,263,208,172,130,88,60,46,39,25,16,11,4,8,5,3,1,2,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   8
- Shortest:  1
- Longest:  34

### composer/composer

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=composer/composer+PHP+variable+name+length&chd=t:0,18,21,53,96,76,114,154,167,134,151,137,119,90,83,81,60,40,30,16,20,17,5,10,5,6,3,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:  10
- Shortest:  1
- Longest:  29

### danielmiessler/SecLists

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=danielmiessler/SecLists+PHP+variable+name+length&chd=t:0,10,4,9,15,15,14,16,5,4,4,2,1,0,1,2,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   5
- Shortest:  1
- Longest:  20

### dingo/api

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=dingo/api+PHP+variable+name+length&chd=t:0,3,0,8,19,25,27,28,19,19,20,10,11,6,9,3,3,5,3,0,2,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   8
- Shortest:  1
- Longest:  26

### domnikl/DesignPatternsPHP

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=domnikl/DesignPatternsPHP+PHP+variable+name+length&chd=t:0,2,2,8,17,16,16,19,13,9,4,7,7,3,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   7
- Shortest:  1
- Longest:  15

### flarum/flarum

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=flarum/flarum+PHP+variable+name+length&chd=t:0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   0
- Shortest:  0
- Longest:   0

### fzaninotto/Faker

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=fzaninotto/Faker+PHP+variable+name+length&chd=t:0,12,20,46,63,49,56,53,73,68,61,41,45,38,40,38,32,17,16,13,11,5,9,4,6,1,0,1,0,0,2,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   9
- Shortest:  1
- Longest:  36

### getgrav/grav

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=getgrav/grav+PHP+variable+name+length&chd=t:0,13,10,51,75,99,96,98,134,111,83,70,75,50,44,28,23,17,10,6,7,7,2,1,1,2,1,1,1,2,2,1,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   9
- Shortest:  1
- Longest:  38

### guzzle/guzzle

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=guzzle/guzzle+PHP+variable+name+length&chd=t:0,10,8,22,36,27,40,33,30,18,11,17,10,5,4,1,4,0,2,2,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   7
- Shortest:  1
- Longest:  23

### laravel/framework

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=laravel/framework+PHP+variable+name+length&chd=t:0,13,9,44,78,126,137,127,148,137,115,98,55,40,48,35,25,15,15,8,3,1,2,3,2,0,0,0,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   8
- Shortest:  1
- Longest:  36

### laravel/laravel

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=laravel/laravel+PHP+variable+name+length&chd=t:0,0,3,2,4,4,6,5,5,3,3,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   6
- Shortest:  2
- Longest:  16

### matomo-org/matomo

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=matomo-org/matomo+PHP+variable+name+length&chd=t:0,33,72,137,205,260,327,436,499,572,623,627,562,514,499,421,354,302,264,204,155,122,105,91,65,43,48,38,30,21,17,13,18,15,8,6,3,6,2,3,1,0,0,1,0,1,0,1,1,0,0)

- Average:  12
- Shortest:  1
- Longest:  48

### octobercms/october

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=octobercms/october+PHP+variable+name+length&chd=t:0,5,8,26,62,79,105,141,161,147,155,137,120,91,78,56,52,26,22,15,6,9,4,9,2,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:  10
- Shortest:  1
- Longest:  27

### phacility/phabricator

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=phacility/phabricator+PHP+variable+name+length&chd=t:0,32,110,198,376,480,639,863,1273,1516,1601,1659,1469,1203,938,633,527,350,236,185,121,79,56,41,24,21,15,7,6,6,1,0,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:  10
- Shortest:  1
- Longest:  35

### phalcon/cphalcon

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=phalcon/cphalcon+PHP+variable+name+length&chd=t:0,5,10,20,35,35,44,45,56,35,33,24,16,8,12,2,3,3,5,2,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   7
- Shortest:  1
- Longest:  23

### phanan/koel

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=phanan/koel+PHP+variable+name+length&chd=t:0,5,5,13,22,25,35,27,21,22,11,12,10,2,2,1,3,2,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   7
- Shortest:  1
- Longest:  26

### roots/sage

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=roots/sage+PHP+variable+name+length&chd=t:0,1,0,2,6,4,2,4,4,3,2,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   6
- Shortest:  1
- Longest:  17

### sebastianbergmann/phpunit

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=sebastianbergmann/phpunit+PHP+variable+name+length&chd=t:0,63,232,192,216,210,281,376,399,392,395,380,364,298,310,252,189,153,125,88,80,54,43,42,29,17,19,11,7,6,9,6,2,3,2,1,0,1,0,2,0,0,2,0,0,0,0,1,0,0,0)

- Average:  10
- Shortest:  1
- Longest:  47

### serbanghita/Mobile-Detect

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=serbanghita/Mobile-Detect+PHP+variable+name+length&chd=t:0,0,0,3,6,8,8,5,7,10,4,4,4,6,0,2,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   8
- Shortest:  3
- Longest:  19

### slimphp/Slim

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=slimphp/Slim+PHP+variable+name+length&chd=t:0,5,1,13,25,22,25,18,21,18,14,12,11,5,7,11,3,4,1,1,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

- Average:   8
- Shortest:  1
- Longest:  23

### symfony/symfony

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=symfony/symfony+PHP+variable+name+length&chd=t:0,31,44,117,178,191,260,331,382,396,372,327,325,258,267,218,153,111,122,79,66,45,45,26,23,13,12,14,5,1,5,1,0,1,1,2,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0)

- Average:  10
- Shortest:  1
- Longest:  41

### yiisoft/yii2

![](https://image-charts.com/chart?chs=800x600&cht=bvs&chds=a&chxt=x,y&chg=1,1&chco=777BB3&chtt=yiisoft/yii2+PHP+variable+name+length&chd=t:0,24,34,66,126,131,200,206,260,255,239,214,193,168,126,85,87,60,48,44,26,16,17,11,5,9,7,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0)

- Average:  10
- Shortest:  1
- Longest:  39

以上是关于markdown AVNLIPPP - 流行的PHP项目中的平均变量名称长度的主要内容,如果未能解决你的问题,请参考以下文章

10款流行的Markdown编辑器,总有一款适合你

markdown 面向前端开发人员的10个流行的JavaScript面试问题

markdown PHPUnit版本中`TestCase`类中最流行的更改摘要

markdown速成语法

使用Markdown写文档

CCF 201703-3 Markdown