10072007 0555 GMT-6 DST
Im sorry I didnt make this more clear.
Where Im working at is this: Im working with existing code. A function
opens the file, parses it, and puts it into a new data file. At this
point it is posted to the web. What I need to do is, Im working with (at
least right now) a single variable that is not being display correctly.
The variable is $vartext[13]. It consists of either a - or a + and a
number.
At the moment if the number is a negative it is displayed correctly as
-2 (or whatever number it is) but when its a + it is posted as + 2, with
a space between the number.
I guess I could run a loop on this:
$string = str_replace("+ i", "+I", $string)
but is that the best way to go?
Wade
[EMAIL PROTECTED] wrote:
> ----- Original Message -----
> From: "Wade Smart"
>
> Hey, back on this issue again,
> I have this number
> + 2
> and its supposed to be
> +2
>
> These numbers come in a data file.
> A program parses these numbers.
> Its not adding a space.
> I ran through count_chars and got:
> 10 new line
> 32 space
> 43 +
> 50 2
>
> Im struggling to see how to get this + next to the 2 like this +2
> instead of like + 2.
>
> Wade
> ----------------------------
> PHP Version 4.x.x
> <?php
> $handle = fopen("filename.ext", "r");
> $string = "";
> while(!feof($handle))
> {
> $string .= fread($handle, 8192);
> }
> fclose($handle);
> $string = str_replace("+ 2", "+2", $string);
> ?>
>
> PHP Version 5.x.x
> <?php
> $string = file_get_contents("filename.ext");
> $string = str_replace("+ 2", "+2", $string);
> ?>
>
>
>
> Community email addresses:
> Post message: [email protected]
> Subscribe: [EMAIL PROTECTED]
> Unsubscribe: [EMAIL PROTECTED]
> List owner: [EMAIL PROTECTED]
>
> Shortcut URL to this page:
> http://groups.yahoo.com/group/php-list
> Yahoo! Groups Links
>
>
>
>