Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

php_strip_whitespace(3) [php man page]

PHP_STRIP_WHITESPACE(3) 						 1						   PHP_STRIP_WHITESPACE(3)

php_strip_whitespace - Return source with stripped comments and whitespace

SYNOPSIS
string php_strip_whitespace (string $filename) DESCRIPTION
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. PARAMETERS
o $filename - Path to the PHP file. RETURN VALUES
The stripped source code will be returned on success, or an empty string on failure. Note This function works as described as of PHP 5.0.1. Before this it would only return an empty string. For more information on this bug and its prior behavior, see bug report #29606. EXAMPLES
Example #1 php_strip_whitespace(3) example <?php // PHP comment here /* * Another PHP comment */ echo php_strip_whitespace(__FILE__); // Newlines are considered whitespace, and are removed too: do_nothing(); ?> The above example will output: <?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. PHP Documentation Group PHP_STRIP_WHITESPACE(3)

Check Out this Related Man Page

TOKEN_GET_ALL(3)							 1							  TOKEN_GET_ALL(3)

token_get_all - Split given source into PHP tokens

SYNOPSIS
array token_get_all (string $source) DESCRIPTION
token_get_all(3) parses the given $source string into PHP language tokens using the Zend engine's lexical scanner. For a list of parser tokens, see "List of Parser Tokens", or use token_name(3) to translate a token value into its string representation. PARAMETERS
o $source - The PHP source to parse. RETURN VALUES
An array of token identifiers. Each individual token identifier is either a single character (i.e.: ;, ., >, !, etc...), or a three ele- ment array containing the token index in element 0, the string content of the original token in element 1 and the line number in element 2. EXAMPLES
Example #1 token_get_all(3) examples <?php $tokens = token_get_all('<?php echo; ?>'); /* => array( array(T_OPEN_TAG, '<?php'), array(T_ECHO, 'echo'), ';', array(T_CLOSE_TAG, '?>') ); */ /* Note in the following example that the string is parsed as T_INLINE_HTML rather than the otherwise expected T_COMMENT (T_ML_COMMENT in PHP <5). This is because no open/close tags were used in the "code" provided. This would be equivalent to putting a comment outside of <?php ?> tags in a normal file. */ $tokens = token_get_all('/* comment */'); // => array(array(T_INLINE_HTML, '/* comment */')); ?> CHANGELOG
+--------+----------------------------------------+ |Version | | | | | | | Description | | | | +--------+----------------------------------------+ | 5.2.2 | | | | | | | Line numbers are returned in element 2 | | | | +--------+----------------------------------------+ PHP Documentation Group TOKEN_GET_ALL(3)
Man Page

13 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

PHP function kills my code?

So I'm making a page for one of my web sites that scans the visitors ports (just a few specific ones, not ALL) and tells them if they have any open. Now I made up the code and it worked great. Now instead of having the same chunk of code all over my script, I tried to make my own subroutine so I... (10 Replies)
Discussion started by: l008com
10 Replies

2. UNIX for Dummies Questions & Answers

PHP scripts problem!

Hi, I've configured a server with Debian Etch 4.0. I followed these instructions: Install and Configure Apache2 with PHP5 and SSL Support in Debian Etch -- Debian Admin But when I try to launch a php script with phpinfo() in my browser, It showed me the download manager window.(i.e. wanna to... (9 Replies)
Discussion started by: mjdousti
9 Replies

3. Shell Programming and Scripting

sed - delete until char x

Hi, I got a Textfile contains hundreds of lines like this: 3 02 8293820 0 22 22 All I need is this: 293820 0 22 22 So i decided to delete until the first '8' comes up. But how I can realize that? (9 Replies)
Discussion started by: mcW
9 Replies

4. HP-UX

vmstat, comments and advices needed

Hi all.. I need some comments or advices about my HP-UX 11.11 performance. It runs Oracle, some apps and weblogic. For several times in a day, it's performance drops poorly (approx for minutes until an hour). I tried to find articles about unix, oracle and weblogic tuning, which leads me... (13 Replies)
Discussion started by: galapagos
13 Replies

5. UNIX for Advanced & Expert Users

whitespace problem

I have a single string as below: Rat run after Cat i.e. there is a single whitespace after Cat. This causes my file to fail. Is there a way I can remove any whitespace at the end of any string. I tried sed 's/ *//g', but it removes all white space and the above string becomes... (10 Replies)
Discussion started by: RubinPat
10 Replies

6. Shell Programming and Scripting

Help with PHP and shell_exec!!!

Hi, I've been working on a PHP script which is "supposed" to find an individuals weather based on their geolocation. This script uses "shell_exec". I have checked my syntax and it is correct, but there is still something missing; for when I call on the script using: <form action='/weather.php'... (15 Replies)
Discussion started by: o0110o
15 Replies

7. Shell Programming and Scripting

New Member - First Question

Here is my situation... System - HP UNIX (HP-UX hq5 B.11.00 U 9000/800 (td)) I have an HL7 (Health Level Seven) pipe-delimied file that does not have any carriage returns/line feeds. I need to insert a line feed before each segment type (MSH, PID, PV1, OBX, etc.) so that my PROGRESS program... (16 Replies)
Discussion started by: varefump
16 Replies

8. Shell Programming and Scripting

Removing Multiple Line comments

:) Hi all, I would like to remove all multiple line comments, in between the pattern /*.....*/ from my file. The comments can be expected to be at any place in my file, like this: /*.... This multi line comment might stretch even the entire file..! ......*/ Some text Text1 /* Comment... (25 Replies)
Discussion started by: Jackuar
25 Replies

9. UNIX for Dummies Questions & Answers

put script into file

hi, ok having here some code like: #!/bin/bash echo " hello " # say hello to the user echo " $HOME " echo " $HOSTNAME " echo " $(uname) " echo " today is $(date) " echo " $(whoami) is currently logged in " now my question is how to change the code so that the info is not... (12 Replies)
Discussion started by: me.
12 Replies

10. Shell Programming and Scripting

source ... how to initiate once in linux or php

Hi I'm using this script for PHP purpose: script.sh ------------------------- #!/bin/bash source app_path/config_file' app_name $* script_name the thing that bothers me is that every time I call app_app_name $* script_name I have to run source, which of course is required in this... (12 Replies)
Discussion started by: soonic
12 Replies

11. Shell Programming and Scripting

Encrypt php lines

there are some lines of php code like a copyright that i want to encrypt so people can't search for it and then remove it how can i encrypt the code so it just looks like numbers and letters and not in readable format? thanks :) (11 Replies)
Discussion started by: vanessafan99
11 Replies

12. What is on Your Mind?

Port VPM Decompression Algorithm to PHP and then to Dive Computer

Hello! I'm about to embark on a new project to port the VPM (Variable Permability Model) for decompression diving from some old BASIC code (attached, "VPM.txt") to PHP. Then, I plan to create a plugin for this site where folks can run VPM on the web. Then, I plan to improve VPM based on... (15 Replies)
Discussion started by: Neo
15 Replies

13. Shell Programming and Scripting

Question for SED preg_replace

I want to make it in SED PHP preg_replace('@<script*?>.*?</script>@siu','',$text); this is in AWK awk '/<script /{p=1} /<\/script>/{p=0; next}!p' can you help me to make it on SED working? I have this sed 's/<script*>*<\/script>//g' but it not work with this string <script... (9 Replies)
Discussion started by: sanantonio7777
9 Replies