Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




How Do You Get Php To Output More Than One Space?


I can write a string to the screen, but if i want to put tabs between them, php will print ONLY ONE space instead of the tab. if i replace the ' ' with 50 spaces, the screen will only output one. im trying to create a tree like structure like the following


element one
*<tab>* response to element one
element two
*<tab>* response to element two

each of the tabs is reduced to one character.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Remote Server Disk Space & Free Space
how can i get the remote server disk space & free space by using php script?

Regular Expression Space And 2 Byte Space
When receiving a particular string and if the string has a space/ 2 byte
space with some trailing string.
I want to remove the trailing string.

$somestring = "some string";
$match_pattern = "/(.*)s.*/iu";

preg_match_all($match_pattern, $somestring, $match );
echo $match[1][0]

Looks like this only works for single byte space.

How can I define the regular expressoin so that it finds the 2 bytes space.

Making Gmdate Output Equal Date Output
gmdate('F j, Y, g:i a',0) returns January 1, 1970, 12:00 am.
How do I add to the second parameter of the date function to make it
always return that same date, regardless of the time zone?
Intuitively, it seems like date('F j, Y, g:i a',0 - date('Z')) should
do it, but on my system, that's an hour off.

Here's some sample code:

<?
echo gmdate('F j, Y, g:i a',0).'<br />'
echo date('F j, Y, g:i a',0 - date('Z')).'<br />'
echo date('F j, Y, g:i a',0 - date('Z') + 60*60);
?>

And here's the output on my system:

January 1, 1970, 12:00 am
December 31, 1969, 11:00 pm
January 1, 1970, 12:00 am

Will the last echo always return the same thing as the first echo,
regardless of the time zone? If so, why? It seems that the second one
is the one that should do it - not the first one.

Space To +
How can I take all spaces from a variable and turn them into a + char.

Variables W/ Space Gets Cut Off On GET
I'm not sure why my text spaces aren't getting changed to %20. When I click a link w/ variables in it, the next page only gets the first word contained in the variable.

Any idea why this is happening? I don't remember having to do anything when passing multiple worded values across pages.

Space Replacement
I want to replace the space between the word into hyphen (-)

like word is

SITE OPTIMISATION TECHNIQUE , i want to replace it to
SITE-OPTIMISATION-TECHNIQUE

actually i am using this system to rewrite URL to convert it to search engine
friend url i.e. mod_rewrite ...

Php Value Disappear After The First Space ?
why is the value of a php variable disappear after the first space ? i was coding :-

echo "<a href=javascript:goto('$a[0]',$a[1]')>$a[1]</a>

but if the value of $a[0] is 'T h i s' then when my mouse is over the anchor,the value is :- javascript:goto('T this is a syntax error !

Adding Space To URL
My script displays URLs of other sites, and I'm seeing that very long URLs don't wrap within the table, therefore pushing out the borders and spoiling the format.

Can anybody give me a piece of code that will take an URL variable (e.g. $url) and parse it to place a space after the 1st forward slash
(e.g. http://www.example.com/very/long/url/ would be replaced by http://www.example.com/ very/long/url/)

Alternatively, the space could be placed after the second slash, so that not so many URLs are changed this way.
(e.g. http://www.example.com/very/long/url/ would be replaced by http://www.example.com/very/ long/url/)

Getting Rid Of White Space
Anyone have a quick simple way of getting rid of white space in the middle of a string? I've tried str_replace("  ", " ", $string) but doesn't seem to do it, I guess it doesn't work with spaces?

Replacing A Space With -
If I have $town='Town Name' and it displays "Town Name" how can I get it to display "Town-Name" instead.

Replacing A Space With %20
I have a script that shows a list of uploaded files, with a button saying Delete.

<?PHP 

$folder = "../files/upload/"; 
$handle = opendir($folder); 

# Making an array containing the files in the current directory: 
while (false !== ($file = readdir($handle)))
{
    if ($file != '.' && $file != '..')
       $files[] = $file; 

closedir($handle); 

#echo the files 
foreach ($files as $file) { 
    echo "-<a href=$folder$file><label title=file>$file</label></a>";
echo "    [<a href=filedelete.php?file=$file>Delete</a>]<br />";

?>

Now something is very weird, because if you attempt to delete a file that has a space in it, it appears as eg:

filename: de_dust A.jpg
file comes out as: de_dust

I need some way to replace the space with that %20 thing that normally shows up in links if there is a space in it.

How Much Space A Folder Is Taken Up
How is everyone? Well I was just wondering if somebody got teach me how to make a PHP Script which tells you how much space a folder is taken up? Example: I have a folder called ./files, I want a script which will tell me howmuch space its taken up .

Regex - Just A Space
includes various characters apart from just a single " ". Is there any way to limit it just to a space and omit vf etc?

Finding A Space In A String
I am trying to find a space in a string. If I have a sentence like:

This is a sentence.

I would like to be able to find the second space form the endand then return that part of the sentence, so if I ran it on that sentnece above it would return "a sentence.", but I won't know what the sentence is.

Removing A Space After Submitting
I am working on a script that creates options with a number to be inserted into an array PHP Code:

Help Removing A Simple Space
I need to check for sentences that have a space before the period and
remove the space. I've tried:

$sentence = str_replace(" .", ".", $sentence);

but it does not work. I've tried other ways with no success.

Why doesn't this work and how do I do this?

Linking To Files Which Contain A Space
I'm getting errors when I try to view a file located on the server which has a space in it's name. For example "test file.txt" gets a link of "http://www.domain.com/directory/test ". Files with no spaces such as "test_file.txt" are fine. PHP Code:

Trim After Last White Space
I have the following code which returns the first 100 characters. Now I would like to trim everything after the last white space. PHP Code:

Fwrite When Out Of Storage Space
I have a problem that has long plagued me:

What is the best way to check if I'm out of space?
I have a file editor application (could apply to anything though).
If the server (Apache on SunOS) is out of diskspace,

$fp = fopen($file,'w');
fwrite($fp,$string,strlen($string));
fclose($fp);
creates a nice 0-byte file.. no error or anything.

Do I need to write to a test file and check it's filesize first??
There's gotta be a better way.

This is a server where the log files get out of control and that's out
of my jurisdiction.

Calculating Free Space Available
Is there a way to tell how much space is remaining available for files? I'm working on a script that takes uploaded images and adds them to a database, but I'd like to check and make sure there's room for it first.

I think there's probably going to be some type of issue with quotas, because that's how I found the problem. A user had uploaded a test version and got an error that a folder could not be created because of insufficient space remaining.

And I know I could probably exec() out to df or something similar, but I would like it to work on Windows servers as well, so I'd prefer to keep it all in PHP code if possible.

Hard Disk Space
i would like to know how to find a file in the entire system, i want to create a search so that the user enters the file name and the the script searches the entire system for the file,and later on displays the result of the search.

PHP Form Space Issue
I have some code that displays 2 select boxes one on top of the other. I am trying to display them without any space between them. It doesn't seem to be possible. PHP Code:

Passing DB Values With A Space In The URL
I have written a web app that takes results from an Informix DB. this DB is part of a legacy system and as such, I cant change the data in it. i am only writing something that outputs the data.

One of the DB fields holds placenems and these in some cases are two words ie: San Diego. Now, there is a second page which produces further results depending on the placename. I pass the placename value to the next page in the URL but, and here's the problem: Normally, I pass the value like so: link.php?name=$placename If the placename is Dublin then the link would be PHP Code:

Seperating Vars From Db With Space.
What the script is going to be used for is: People can registrate a username and password. I have to check my database if anyone else have this username... Therefore I grab every username from the database, and then I make an if/else statement.
how can I seperate the results? Because if I try to "echo" $user, the results appear in one word, and not one word for each result. Code:

Remote Disk Space ...
can't manage to do it ..... was so easy under solaris ....
anybody knows how to get free disk space on remote disks ???

(with both local and remote *$#@%§&* machines running *$#@%§&* W$2000)

White Space Position
how do i find if there is white space in a string eg. "hello how are you?" also how do i return the position of that white space?

Replace Underscore _ With Space - How?
I'm developing an application for a client, and the current setup is that the entries in the database have underscores in instead of spaces, i'm persuming the previous developer did this for query reasons...

basically its town names which have a space ie 'Colwyn_Bay'how do I substitute the _ with a space in the php echo code to display this as 'Colwyn Bay' and not Colwyn_Bay?
I'm using <?php echo $searchquery_town; ?>

Space In The Download Filename
I have made a small page where users can upload files and then download them from another, however if there is a space in the filename the download will not work properly. I was just wondering if thats how things are or if there is a way round this?

Form Pass A Space?
I have a database and i create a record with $login = "carter n"

when i go to edit, it sets $login = "carter" and drops the "n"..

how can i stop this happening, while allowing the use of the space?

any thoughts?

Append Two Textfields Into A Third One With A Space
i dont know if its a stupid question but im so new to php you can forgive  me
well the thing is i have 3 text fields

textfield1
textfield2
textfield3

I want to add textfield 1 with textfield 2 and display it in a hidden textfield3 with a space between the text.

Textfield1(Sam) + Textfield2(Yam) = Textfield3 (Sam Yam)

White Space Manipulation
got a string i.e. "Hello World 2007".

aim is to remove only one white space when prompted ie. remove the first and end up with "HelloWorld 2007" or the 2nd and achieve "Hello World2007". Could be a string with more white space.

Any functions that single out a specified character? but only 1 such as take the 2nd white space but leave the first?

Database Or PHP Adding A Space
I recently had to change all my embed code to get Quicktime Player to work in Windows. Unfortunately, now my php scripts are not working properly because a white space is getting added to the end of a field in the database (even though it doesn't appear to be this way in the database). So I am looking to use regex or something to take the database field and stop when the space begins; but I'm so far from understanding regex.. Code:

Check For Available Disk Space
Does anyone have a nice script (or idea) of how to check for available
diskspace? There must be a better way than traversing all the files and getting the size and substracting it from your hardcoded disksize...

White Space In Select Option
I'm having a problem with a <select><option> which has white space in
values...

When I post the data I only get the first word (up to the white space).
"Testing white space" becomes "Testing" after posting

<select name="descr" id="descr">
<option value=Testing white space>Testing white space</option>
<option value=Testing white space two>Testing white space two</option>
<option value=Testing white space th>Testing white space th</option>
</select>

I am using form method = post and have also tried method = get

How do I get the full string from the value field.

Open Sourece Yahoo 360 Or MSN Space
I am looking for a Open sourece yahoo 360 or MSN space like software which i can use it in my website.

Checking String For Max Length Without Space
I have a form where people enter their username. I have a limit of 50 characters for their name (that's easy enough to police) but much trickier is this. They can't have more than 15 consecutive letters without a space. If they do, it throws out the formatting of my HTML tables. Is there a way in PHP to check that there is never a sequence of 15 or more letters without a space in a string?

Removing Space Characters From A String
How do I remove space characters from a string using PHP?

For example, the following string...

' hi there, my name is burnsy '

....has spaces, at the edges and inbetween the other characters. I know
I can use trim() to remove the outside ones but how do i remove the
inbetween ones so it will read:

'hithere,mynameisburnsy'

Check For The Ammount Of Disk Space Being Used
Which function would i use to check for the ammount of disk space being used in a folder or directory?

If No Data From Form, Then No Blank Space?
If I have a form (a guestbook for example) and only have some of the fields required, what do I need to do to pass the info to the results/display page if they filled in the data, but not leave a blank space if they didn't? Some sort of collapse table or something?

Add An Extra Space After Period In A String
I want to be able to add an extra space in each instance
after a period in a string. I am already stripping out extra
whitespace throughout, so to start I have a nice flat string to work
with. I am struggling getting the syntax right and keep getting funny
results. What is the simplest way to accomplish this?

Netscape Truncating String At Space
While using the following commands with Netscape the "string" gets truncated to the first occurence of a space. Code:

Forms Value And Php Echo Stops After First Space
The title is maby a bit strage, I had problem coming up with a title
that explain my problem.

I have a variable $myvar="TEST 123"

I would like to use this variable as a default value in a form. I have
tryed this code:

<input name="testbox1" type="text" value=<?php echo "$myvar"; ?>>
the result is a form with a textbox with the default value "TEST"

I have tryed

<input name="testbox2t" type="text" value=<?php echo "TEST 123"; ?>>
Same as before the default value is only "TEST"

But if I try

<input name="testbox 3t" type="text" value= "TEST 123t">
the default value is "TEST 123"

all my test code is inside the <form> </form> statement

Upload File Without White Space In The Name
I don't know how to remove white space between two words if file name consist of two words. What should I put in the script below to remove the space? Code:

How Can I Check If A Field Value Contains Only Space Characters?
I am using a FCK editor and i want to validate the textarea value. I want to check if the value contains only space characters and if so give an error. I have tried the trim function but that is not working.

Finding Local Disk Space
how to find the local disk space in php? I tried the command df -h, it gives me the details of the space for local drives as well as for all the mapped drives. All I want is to get the disk space of local drives. df -l, doesnot work. I can get the space details if I hardcode the drive letter. Need to find the local disk space without hardcoding the drive letters.

Selecting Server Space Provider.
I need a vital piece of advice, that will definitely help me in choosing a server space provider based on their merits.

I truly understand, this is a very important step, if not, it will take a lot of effort to migrate to a new space later.

The problem is, every provider say, they are the one and no one else, but when you list a set of questions, they back out in some.

Based on my requirement below and based on your experience, please suggest some server space provider and advice. I understand that you are not an ambassador of that company, but just a word of mouth.

I am in Singapore, Is it necessary and / or wise for me to choose a server space provider in Singapore.

I have got a reply from a server space provider, they mentioned the following:

They do not support my “automated “email out” (SMTP) function”. But I need this.

I need clients upload image to server facility.

They promise 45Mbps both way , is it normal?

Max MySQL connection per time is 5, but Max clients per time is no limit, is it normal? What usually happens if at any instance the max  MySQL connection is more then 5? Will this ever happen?  Since the seek time is in terms of microseconds.

Determine Free Disk Space
Is there a way that PHP can determine the amount of free disk space (Linux system)?

I have tried to manipulate the output from $df -h but it's not really working properly.

Remove The Space When I Get Value From Excel File
I has a excel import function, and will display out the value in each text box (col by col).

but if some of the fields got space, i cant removed the space;

for example:

in excel row 1 col A: _ _ 123; I want remove the space.

I try using str_replace and trim, also not work..

Replace Space With &nbsp In City Names.
We have a database of city names. For cities of more than one word, we want to keep all words on the same line.

so we would replace the space of Los Angeles --> with should be something like
Los Angeles

Is there a way to do this as we display the page with php?


Copyright © 2005-08 www.BigResource.com, All rights reserved