How the PHP program handles the interval numbers in a string

Source: Internet
Author: User
I'm going to work with a string that assigns the string to the variable to access the database, but the system always goes wrong. When there is an interval number in a string, the data after the interval number cannot be inserted. Handle the English or digital good in this string. The problem is that in this type of string, there may be kanji and spacer characters! I want to replace this number with other symbols (single-byte symbols) when I hit the interval number.
How do I judge this spacer in a PHP program? (ASCII code A1A4). I've been searching the internet for half a day. Only to find a way to deal with the Chinese characters php

1. The character is converted into ASCII (ORD function) into the variable;
2. Determine if the variable belongs to Chinese characters
3, if it belongs to Chinese characters, skip a character, then judge the next
4. Skips a character if it is not a kanji character.
The question is how to judge the interval number?

Is there any other way?


Reply to discussion (solution)

Addslashes ($STR)
To the string to be added into the database with the function of processing, join the database will not be wrong

Fusioncharts I used to feel good, basic graphics have

No way!
To solve the problem, you need to see your code and data

How do you define the interval number? Just find the character and replace it.

Data is not written to the database you have to look at your SQL statement, followed by the data format you want to insert is satisfied, generally this does not need to replace as long as the conversion can be successfully written to the database, or Rich text editor that is not to use it?

Finally, by setting the character set to solve the problem, the original character set does not know "spacer", what function is not good, and finally changed the character set, just fine

  • 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.