PHP reference problems

Source: Internet
Author: User
PHP reference problem I reference the function cut () of file B in file A, and write include_once (& quot; B. php & quot;); then call & lt ;? Phpechocut ($ arr [title], 28 );? & Gt; but I don't know why I always run the error Fatalerror: Calltound PHP reference.
I reference the function cut () of file B in file A, write include_once ("B. php") on page A, and then call But I don't know why I always run the error Fatal error: Call to undefined function cut () in D: \ XAMPP1.7.3 \ xampp \ htdocs \ web \ index. php on line 233
Is there no CUT function defined? But I clearly defined it. When you view the source file on page A, the section that should show the result shows my CUT function code.
The CUT function is Function cut ($ Str, $ Length) {// $ Str is the string to be truncated, and $ Length is the Length to be truncated.

Global $ s;
$ I = 0;
$ L = 0;
$ Ll = strlen ($ Str );
$ S = $ Str;
$ F = true;

While ($ I <= $ ll ){
If (ord ($ Str {$ I}) <0x80 ){
$ L ++; $ I ++;
} Else if (ord ($ Str {$ I}) <0xe0 ){
$ L ++; $ I + = 2;
} Else if (ord ($ Str {$ I}) <0xf0 ){
$ L + = 2; $ I + = 3;
} Else if (ord ($ Str {$ I}) <0xf8 ){
$ L + = 1; $ I + = 4;
} Else if (ord ($ Str {$ I}) <0xfc ){
$ L + = 1; $ I + = 5;
} Else if (ord ($ Str {$ I}) <0xfe ){
$ L + = 1; $ I + = 6;
}

If ($ l >=$ Length-1) & $ f ){
$ S = substr ($ Str, 0, $ I );
$ F = false;
}

If ($ l> $ Length) & ($ I <$ ll )){
$ S = $ s. '...'; break; // if it is intercepted, the end of the string is omitted with the symbol "..."
}
}
Return $ s;
}
?>

I don't know what I have to say. I hope someone can help me.

------ Solution --------------------
Have you enabled php tag disconnection? the php tag in your file A should be ------ Solution --------------------
Discussion

Have you enabled php tag disconnection? the php tag in your file A should be

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.