Restrictions on the length of PHP string variables

Source: Internet
Author: User
From: http://163navy.blog.163.com/blog/static/105304086201174111553745/

11:15:53 | category:

PHP & Person | font size subscription

I thought there was no limit because the type section in the PHP Manual did not mention this issue. However, this restriction problem is found in actual applications:

The process of transferring text content from a textarea to the text field of mssql is completely normal, but only the first two thousand characters are displayed during reading.

After searching on the internet, I learned that php. ini has the following settings:

; Valid range 0-2147483647. Default = 4096.
; Mssql. textlimit = 4096
; Valid range 0-2147483647. Default = 4096.
; Mssql. textsize = 4096

It can be seen that php does not have a limit on the variable size (the limit of 2 GB can be regarded as nonexistent currently), but is limited to 4096 bytes by default, that is, 2048 Chinese characters.

Therefore, the following two lines are added to the Code to solve the problem:

There are two excellent sentences:
Ini_set ("mssql. textsize", 200000 );
Ini_set ("mssql. textlimit", 200000 );

(Enough for 100,000 Chinese characters .)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.