Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8345645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:44:53+00:00 2026-06-09T06:44:53+00:00

Today, i have very weird problem with trim function. Here is my code. =and

  • 0

Today, i have very weird problem with trim function.
Here is my code. =and result is 124.
Trim function didn’t work with this string ??!

$s = '                                                                                  ';
$s = trim($s);
echo strlen($s);exit();

Copy & paste doesn’t work with this code.
i don’t know what white space is? but trim couldn’t strip it 😐

you can test this code here:

test:
http:// 70.38.18.62/t.php

You can copy white space and code over there:
http://jsbin.com/ukunuq/1/edit

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:44:54+00:00Added an answer on June 9, 2026 at 6:44 am

    When I look at your t.txt, the $s string is not just spaces. In Hex, it reads a mixture of 20 (space) and C2 and A0 characters. You need to lose those C2 and A0 characters.

    They may not display on screen, but they are NOT spaces. Here’s my sniff of what’s returned

    Screen Capture

    Possibly encoding the file in 7-bit ASCII would also reveal the problem.

    To clean it up, just select all the text in $s, delete it and then hit space bar to get the right number of spaces. Or use str_repeat(‘ ‘, 134) that will do the same. Check the charset of your editor.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I ran into a very weird problem today. Long story short, my function returns
I've noticed some very strange behaviour today in Code Igniter. I have this locations
Today I found a very mysterious bug in the code. I have used the
Today i have been interested in answers on this: where you create your work
Today I have seen this weird magic NTFS system supports: each file can have
Hi this question or problem i have its very hard i have search and
This is my first question on S.O. I have a very odd problem. Below
I have a very specific problem here. I have a multi-dimensional array that I
Today i was debugging some lines of code and i noticed a very weird
Today I have question about Eclipse . I use this IDE very long and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.