php_strip_whitespace

(PHP 5, PHP 7, PHP 8)

php_strip_whitespaceReturn source with stripped comments and whitespace

Beschreibung

php_strip_whitespace(string $filename): string

Returns the PHP source code in filename with PHP comments and whitespace removed. This may be useful for determining the amount of actual code in your scripts compared with the amount of comments. This is similar to using php -w from the commandline.

Parameter-Liste

filename

Path to the PHP file.

Rückgabewerte

The stripped source code will be returned on success, or an empty string on failure.

Hinweis:

This function respects the value of the short_open_tag ini directive.

Beispiele

Beispiel #1 php_strip_whitespace() example

<?php
// PHP comment here

/*
 * Another PHP comment
 */

echo        php_strip_whitespace(__FILE__);
// Newlines are considered whitespace, and are removed too:
do_nothing();
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

<?php
 echo php_strip_whitespace(__FILE__); do_nothing(); ?>

Notice the PHP comments are gone, as are the whitespace and newline after the first echo statement.

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Kategorie: Software & Web-Development

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

creation site web maroc

----------------- Mouatamid ----------------- Le cabinet Mouatamid Law Firm (https://www.mouatamidlawfirm.com/) est un cabinet d’avocats maroca ...

Geschrieben von redcityweb am 16.02.2026 12:26:49
Forum: Ankündigungen
creation site web maroc

----------------- Kraftsol ----------------- Kraftsol (https://www.kraftsol.ma/) est la référence marocaine en matière de carreaux de ciment ha ...

Geschrieben von redcityweb am 16.02.2026 12:24:52
Forum: Ankündigungen
creation site web maroc

----------------- ksarshama ----------------- Découvrez le charme du Haut Atlas marocain (https://www.ksarshama.com/) en séjournant dans un hô ...

Geschrieben von redcityweb am 16.02.2026 12:22:35
Forum: Ankündigungen
creation site web maroc

----------------- Duchapro ----------------- Duchapro – Équipements sanitaires & sanitaire design à Casablanca, Maroc Duchapro (https://www.d ...

Geschrieben von redcityweb am 16.02.2026 12:21:01
Forum: Ankündigungen