Mombu the Php Forum

Go Back   Mombu the Php Forum > Php > Comparison Problems with 5.2.5
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 3rd November 18:27
magnus
External User
 
Posts: 1
Default Comparison Problems with 5.2.5



Hi,

I have runned into a slight annoying problem with my code, that I have never
had before.
Either I have something wrong in my code or PHP 5.2.5 that I user is acting
weird in windows. I have recently installed PHP on my windows machine for
local developement instead of a remote server.

What I try to do is to make an if statement betwean two string numbers.

$_USER['level'] = The level the user has

The $_USER['level'] string is taken from the Database and is "5".

This will not work (I expect this to work since _USER['level'] is 5)
if($_USER['level'] => 5)

This will work (And I expect it to work to)
if($_USER['level'] => 6)

This will work (Not supposed to work since _USER['level'] is 5)
if($_USER['level'] > 5)

--
View this message in context: http://www.nabble.com/Comparison-Pro...p14547671.html
Sent from the PHP - General mailing list archive at Nabble.com.
  Reply With Quote


 


2 4th November 09:56
ceo
External User
 
Posts: 1
Default Comparison Problems with 5.2.5



You want >= and not =>

The => operator doesn't even make any sense in that context, as far
as I know...


--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?
  Reply With Quote
3 4th November 09:56
ceo
External User
 
Posts: 1
Default Using PHP to remove certain number of bytes from file


Something like this might work:

<?php
$path = "/full/path/to/file";
$file = fopen($path, 'r+') or die("Could not open $path");
//read 200 bytes
$goners = fread($file, 200);
if (!strlen($goners) === 200){
ftruncate($file, 0);
}
$offset = 0;
while(!feof($file)){
$buffer = fread($file, 2048);
ftell($file, $offset);
fwrite($file, $buffer);
$offset += strlen($buffer);
ftell($file, $offset + 200); }
?>

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?
  Reply With Quote
Reply


Thread Tools
Display Modes




666