I have a .net/vb code which needs to be converted to PHP, can anyone help please?

  private string CharsAvailable()
        {
            int unicodeFlag = 0;
            int extraChars = 0;
            int msgCount = 0;
            string msgString = String.Empty;

            if (chkSignature.Checked)
                msgString = msgString + Environment.NewLine + txtSignature.Text;
            else
                msgString = txtMessage.Text;

            for (int i = 0; (unicodeFlag != 1 && (i < msgString.Length)); i++)
            {
                if ((msgString[i] >= '0') && (msgString[i] <= '9'))
                {
                }
                else if ((msgString[i] >= 'A') && (msgString[i] <= 'Z'))
                {
                }
                else if ((msgString[i] >= 'a') && (msgString[i] <= 'z'))
                {
                }
                else if (msgString[i] == '@')
                {
                }
                else if (msgString[i] == 0xA3)
                {
                }
                else if (msgString[i] == '$')
                {
                }
                else if (msgString[i] == 0xA5)
                {
                }
                else if (msgString[i] == 0xE8)
                {
                }
                else if (msgString[i] == 0xE9)
                {
                }
                else if (msgString[i] == 0xF9)
                {
                }
                else if (msgString[i] == 0xEC)
                {
                }
                else if (msgString[i] == 0xF2)
                {
                }
                else if (msgString[i] == 0xC7)
                {
                }
                else if (msgString[i] == '\r')
                {
                }
                else if (msgString[i] == '\n')
                {
                }
                else if (msgString[i] == 0xD8)
                {
                }
                else if (msgString[i] == 0xF8)
                {
                }
                else if (msgString[i] == 0xC5)
                {
                }
                else if (msgString[i] == 0xE5)
                {
                }
                else if (msgString[i] == 0x394)
                {
                }
                else if (msgString[i] == '_')
                {
                }
                else if (msgString[i] == 0x3A6)
                {
                }
                else if (msgString[i] == 0x393)
                {
                }
                else if (msgString[i] == 0x39B)
                {
                }
                else if (msgString[i] == 0x3A9)
                {
                }
                else if (msgString[i] == 0x3A0)
                {
                }
                else if (msgString[i] == 0x3A8)
                {
                }
                else if (msgString[i] == 0x3A3)
                {
                }
                else if (msgString[i] == 0x398)
                {
                }
                else if (msgString[i] == 0x39E)
                {
                }
                else if (msgString[i] == 0xC6)
                {
                }
                else if (msgString[i] == 0xE6)
                {
                }
                else if (msgString[i] == 0xDF)
                {
                }
                else if (msgString[i] == 0xC9)
                {
                }
                else if (msgString[i] == ' ')
                {
                }
                else if (msgString[i] == '!')
                {
                }
                else if (msgString[i] == '\"')
                {
                }
                else if (msgString[i] == '#')
                {
                }
                else if (msgString[i] == 0xA4)
                {
                }
                else if (msgString[i] == '%')
                {
                }
                else if (msgString[i] == '&')
                {
                }
                else if (msgString[i] == '\'')
                {
                }
                else if (msgString[i] == '(')
                {
                }
                else if (msgString[i] == ')')
                {
                }
                else if (msgString[i] == '*')
                {
                }
                else if (msgString[i] == '+')
                {
                }
                else if (msgString[i] == ',')
                {
                }
                else if (msgString[i] == '-')
                {
                }
                else if (msgString[i] == '.')
                {
                }
                else if (msgString[i] == '/')
                {
                }
                else if (msgString[i] == ':')
                {
                }
                else if (msgString[i] == ';')
                {
                }
                else if (msgString[i] == '<')
                {
                }
                else if (msgString[i] == '=')
                {
                }
                else if (msgString[i] == '>')
                {
                }
                else if (msgString[i] == '?')
                {
                }
                else if (msgString[i] == 0xA1)
                {
                }
                else if (msgString[i] == 0xC4)
                {
                }
                else if (msgString[i] == 0xD6)
                {
                }
                else if (msgString[i] == 0xD1)
                {
                }
                else if (msgString[i] == 0xDC)
                {
                }
                else if (msgString[i] == 0xA7)
                {
                }
                else if (msgString[i] == 0xBF)
                {
                }
                else if (msgString[i] == 0xE4)
                {
                }
                else if (msgString[i] == 0xF6)
                {
                }
                else if (msgString[i] == 0xF1)
                {
                }
                else if (msgString[i] == 0xFC)
                {
                }
                else if (msgString[i] == 0xE0)
                {
                }
                else if (msgString[i] == 0x391)
                {
                }
                else if (msgString[i] == 0x392)
                {
                }
                else if (msgString[i] == 0x395)
                {
                }
                else if (msgString[i] == 0x396)
                {
                }
                else if (msgString[i] == 0x397)
                {
                }
                else if (msgString[i] == 0x399)
                {
                }
                else if (msgString[i] == 0x39A)
                {
                }
                else if (msgString[i] == 0x39C)
                {
                }
                else if (msgString[i] == 0x39D)
                {
                }
                else if (msgString[i] == 0x39F)
                {
                }
                else if (msgString[i] == 0x3A1)
                {
                }
                else if (msgString[i] == 0x3A4)
                {
                }
                else if (msgString[i] == 0x3A5)
                {
                }
                else if (msgString[i] == 0x3A7)
                {
                }
                else if (msgString[i] == '^')
                {
                    extraChars++;
                }
                else if (msgString[i] == '{')
                {
                    extraChars++;
                }
                else if (msgString[i] == '}')
                {
                    extraChars++;
                }
                else if (msgString[i] == '\\')
                {
                    extraChars++;
                }
                else if (msgString[i] == '[')
                {
                    extraChars++;
                }
                else if (msgString[i] == '~')
                {
                    extraChars++;
                }
                else if (msgString[i] == ']')
                {
                    extraChars++;
                }
                else if (msgString[i] == '|')
                {
                    extraChars++;
                }
                else if (msgString[i] == 0x20AC)
                {
                    extraChars++;
                }
                else
                {
                    unicodeFlag = 1;
                }
            }

            if (unicodeFlag == 1)
            {
                msgCount = msgString.Length;
                if (msgCount <= 70)
                {
                    msgCount = 1;
                }
                else
                {
                    msgCount += (63 - 1);
                    msgCount -= (msgCount % 63);
                    msgCount /= 63;
                }
                return msgString.Length.ToString() + " unicode characters, " + msgCount + " SMS message(s)";
            }
            else
            {
                msgCount = msgString.Length + extraChars;
                if (msgCount <= 160)
                {
                    msgCount = 1;
                }
                else
                {
                    msgCount += (153 - 1);
                    msgCount -= (msgCount % 153);
                    msgCount /= 153;
                }
                return (msgString.Length + extraChars).ToString() + " characters, " + msgCount + " SMS message(s)";
            }

        }

Recommended Answers

All 2 Replies

Sorry for bumping, can anyone move this thread to PHP category please?

Member Avatar for diafol

You bumped after less than an hour?

I think it's the slaves' day off today my lord. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.