52
47

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

制御文字を取り除く方法(改行コードは保持)

Last updated at Posted at 2012-03-16
<?php
preg_replace('/[\x00-\x09\x0B\x0C\x0E-\x1F\x7F]/', '', $string); // The line feed and carriage return will be saved.

ここから拝借:
http://stackoverflow.com/questions/1497885/remove-control-characters-from-php-string

52
47
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
52
47

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?