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




Difference Of & In Perl And Php


I'm porting a program from php to perl and discovered, that the bitwise
operator & seems to work differently, which I don't understand why.

I tested it with the values:

a=5543039447 and b=13

Then in perl the expressions:

$result= ($z & $a);

returns 2147483648.

But in php the same expression returns zero.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
2>&1 Arg In Exec(perl.... + "sh: /perl Not Found Error" TIA For Help
I have the following line in a php file:

$msg= exec("perl $scriptPath/insert.pl $d $u $t 2>&1", $returnVal);

Can someone explain the "2>&1" argument?


Second problem, this same line of code when run from the unix command line
returns the following error:

sh: /perl: No such file or directory

I've verified that perl is located in /usr/bin/
/usr/bin is in the environment variable "PATH"
all the directories from php program to the root and back down to usr/bin
have 755 permissions.
if I run the program (insert.pl) from the command line it works
I've tried putting the following in both the php and perl programs:
#!/usr/bin/perl
#!/usr/bin

Any Difference Between These Two?
Is there anything funcationally difference between the following
snippets:

// first
$lines[] = array();
$line =& $lines[count($lines) - 1];

// second
$line = array();
$lines[] =& $line;

They should do the thing. A voice in my head though is saying there's a
subtle difference.

What's The Difference
can i ask (shamelessly) that-

what's the difference between
$_REQUEST['some_entry'] and
$_POST["some_entry"]

?

Difference Between PHP And JSP
can anybody tell me detailed diffrence between PHP and JSP?


Difference Between 4.2.3 And 4.3.0
I have a vended product that behaves differently under PHP 4.2.3 than it
does under 4.3.0. With 4.3.0, I get the error:

Fatal error: Cannot redeclare <function> in <file> on line <line>

Everything I've found indicates that 4.3 will give an error if there is a
duplicate function when 4.2 would not, and the fix is to remove one of
the declarations of the function (and when I do so, the product appears
to work).

However, I am uncertain if the vendor will support a modified version of
their code, so my question is, is there an option to PHP that will give
4.2 behavior in a 4.3 release, compile time, in php.ini, or something
else?

Php 5.2.1 & Php 4.4.2 Difference
I have been using php 4.4.2 I have just installed php 5.2.1 but now find that a couple of things in my script dont work anymore. Like this code <? require('header.php'); ?> is there a difference between 4.4.2  and 5.2.1.

Difference Between PHP Versions
Currently I'm using phptraid as php package and a specific script works just fine but now I downloaded and installed phpdev on my work computer then this same script is not working like it should. Any ideas/suggestion. Is this normal?

Cookie Difference IE/FF
Hello all,
I'm trying to do something very simple: delete (or empty) a cookie.
The following code (which I found in the PHP doc) works fine in IE6 but not
in Firefox:
setcookie ("Cart";, "", time() - 3600);
Any hint on what's wrong ? Yes, I issue this command before sending in any
HTML.

Date Difference
i want to find out date difference. such as $a="2000-10-9" $b="2000-10-10" echo $c=$b-$a;
$c will be 1. how can i make it.

Is *.php And *.phtml Got Difference ?
i have some question with post values. i have two type file, for example, a.phtml and a.php why the a.phtml's $X can be post to b.phtml, but a.php's $X cannot be post to b.php?
ANY DIFFERENT BETWEEN THEM ?

Time Difference
How does one get the difference between 2 time strings?

eg. $s1 = "12:05";
$s2 = "11:04";

Date Difference
how i get the difference between 2 dates. The code i wrote below only returns a value of 3.?

<?php
$date=date("j M Y");
$olddate=&#3901; Jan 2001' ;
$answer = ($date-$olddate);
echo $answer ;?>

Difference Between == And === Comparison
I hope some of you good people would clarify this to me.

Recently I saw a bug in phpBB, which circumvented the way a user is
automatically logged in. The bug is described at:
http://seclists.org/lists/bugtraq/2005/Mar/0104.html

Well, the solution is to change this line:

if( $sessiondata['autologinid'] == $auto_login_key )

into:

if( $sessiondata['autologinid'] === $auto_login_key )

and that confuses me :(

Since in my programming I always use == operator, I was wondering am I
at risk? What is the real difference and when should I use the ===
operator.

I hope you'll understand what I'm asking... since I think it's way
better to learn on others mistakes then on my own...

Month Difference
I am trying to work out the difference in months between 2 dates.

Text Difference
Does anyone know how to display (preferably highlighted) the difference between two sets of text? If I echo two sets of text from MySQL, is there a way to show a difference?

Time Difference
I'm calculating Time Difference (in min)
and it is giving me a absurd value
$f_clkin=1183405223;
$f_clkbrkin=1183405451;
$f_clkbrkout=1183440836;
$f_clkbrkout=1183441924;

$t1=$f_clkbrkout-$f_clkbrkin;
$t2=$f_clkout-$f_clkin;
$min=$t2-$t1;
$min=$min/60;

So Now $min has a value of 21.933333333333 min

How is it possible?? am i doing something wrong..

Date Difference
I have two dates in yy-mm-dd format.i need to find the number of months between these dates.

Difference In Minutes
i have 2 time stamps i want to calculate the Difference in minutes.

Post And Get, Whats The Difference?
I just want to know the difference between the post and get method of a form...when do i use post or get...like when im creating an application/membership form. does the two methods have different impacts on the script triggered by the submit button.

Include() And Require() - Difference?
Is there an easy explaination of when

include()
include_once()
require()
require_once()

should or shouldn't be used? I have had a read through php.net and it all seems a bit vauge about which one should be used when.

Difference Between Mysql_fetch_array, Mysql_fetch_object
Well there are certain queries whose answer i haven't been able to find and want to seek your help. Here are the questions: How many types of tables are there in MySQL and whats the difference between them? Which is the default table type for tables in MySQL? If I have lost MySQL password to login how can i retrieve it. If I'm not able to access to MySQL (say the executable file is corrupted) then how can I take the backup(for both Linux and Windows). whats the difference between mysql_fetch_array, mysql_fetch_object and mysql_fetch_row in PHP? How many values can we set in PHP using the set function?

Difference Between PHP On Windows And Linux
I just got promoted at work from sales to web developer. We have a ton of projects planned including a new CRM from which a lot of our internal tools will be based. My boss despises Microsoft and we primarily use Corel Office products including Paradox for our current CRM. He's been developing in it for years and can make it dance. However, it is straining under the current load and it is clear that its life expectancy is quickly coming to an end. We will be phasing that out as we build web-based tools but it will be around for a while in some capacity as our migration away from it will be a gradual one. For a while I'm sure the two will be used in tandom as we continue to develop our infrastructure and transfer functionality from it to a new CRM.

I will be developing in PHP/MySQL. I also will be using some Perl for cron jobs and other tasks. There will be a lot client-side programming (shouldn't be a factor for this discussion) but all of the apps we have planned will be database driven and there will be over 1 million records (probably closer to 1.25 million) when we actually deploy our tools.

Anyway, I was debating which platform I should use to build our tools on as my boss prefers Windows as he is completely Linux clueless. However, I have only ever developed on Linux/Unix platforms. Whatever I chose now will affect everything I build from here on out so I want to make the right choice the first time.

So my questions are as follows:

1) What are the main differences running PHP (and MySQL for that matter) on Windows versus Linux? Any benefits or pitfalls? Missing functionality?

2) Should I install Apache or use IIS?

3) Our CRM will be generating a ton of documents which will need to be printed. Is this easier on Windows or Linux? I've heard that a lot of developers use Crystal Reports to generate documents. We do have Version 9 if that matters (although I am aware it only works on Windows). I also have little idea how printing is done so any input on that would be wonderful.

4) What would you chose and why?

Difference Between Include() And Require()
can someone please tell me any differeneces?

Image And Text: How To See The Difference
Depending on if I get an image or a text of a certain URL, I want to do
something different. I don't know in advance whether I'll get an image
or a text.

This is a URL that returns an image:
http://indicator.amessage.info/indi...amp;param4=.png

This is one that returns text:
http://indicator.amessage.info/indi...amp;param4=.png

How could I see the difference between the 2 with PHP code?

Md5 / Sha1 - Any Real Difference?
I use md5 hash with some of my cookies and occassionally a hidden form
field - I know the physical data on my network is insecure (unless being
served via https) but I was wondering if there are any advantages to using
md5 over sha1 or versa vicea... I know md5 gives me a unique 32bit hash
while sha1 I've read is 'secure' (?) and gives a 40bit hash... Since The
technical webpage on sha1 is lengthy and for the most part over my head...
and other than today, I've never heard of it before... I was wondering if
anyone could offer any comments on it...

What Is The Difference Between Ajax POST And GET
As all knows the difference between GET and POST is in the way how
the data is transfered,

But in case of ajax Though it may be a post Request we need to
format a querystring manually and send with the url,

My question is there any other way that without sending the query
string can we get the post values as in a normal form submit.

Difference Between 'const' And 'define()'
What is the difference between 'const' and 'define()' ? When would I
prefer using 'const' over 'define', or vice versa? It seems if i do:

const secondsInMinute = 60;
define("secondsInMinute", 60);

Aren't these two the same thing?

What's The Difference Between These Magic_quotes_* Directives?
I'm looking at a function whose purpose is to "prepare" the
contents (usually input by a user) of a variable to be inserted into a
MySQL database. It's pretty simple, really; just check to see if
magic_quotes_* is on and then addslashes() if it's not.

What I'm having trouble wrapping my head around is the difference
between magic_quotes_gpc and magic_quotes_runtime.

The function I'm looking at calls get_magic_quotes_runtime() to decide
whether or not to apply addslashes() to the data, but I can't help but
think that it should be calling get_magic_quotes_gpc() instead,
considering the data is coming from *outside* and going *into* the
database...

Am I misunderstanding something here, or did someone do a no-no with
that function?

TIME Difference And Comparrison
I have two different mySQL times which are about to be stored in the database: Each entry will contain:

$prst = "10:00:00"; - The start of a shift
$prend = "13:00:00"; - The end of a shift

Say I wanted to make sure that the time between these two is not less than 2.5 hours. How do I do this using php? Also, I am aware of CURTIME(); , however, having entered multiple $prst's and $prend's, how can I determine, based on the current time, which shifts would be selected as containing the current time. (I will be making a query against the database using CURTIME but not too sure how to do this.)

PDFlib And ClibPDF - What Is The Difference?
I've read the PHP online help file and I believe the ClibPDF functionality
is seperate, but similar to the PDFlib version - What is the difference? Why
would one use one, instead of the other? I know the PDFlib is not GPL (or I
believe its not) but I do not know the ownership of ClibPDF - Is it GPL
managed? I'm about to get involved with PHP and PDF creation and want to
make sure I start of on the right foot...

Difference Between Var And Private In A Class
I've looked everywhere (including php.net) and can't seem to find the answer
to this simple question.

What's the difference between var and private when initializing a variable
in a class?

For example:

class myClass {

var $var1;
private $var2;

// constructor
function myClass() {
// do something
}

}

Showerror() Vs Mysql_error() ..... Difference
Could someone give me the quick difference betweeen the 2 error
functions and why one should use one or the other.

if (!mysql_select_db($database, $connection))
showerror();

$connection = mysql_connect('mysql_host', 'mysql_user', mysql_password')
or die('Could not connect: ' . mysql_error());

Sortign String - Why This Difference?
I have 2 arrays which I sort ny the first one.

for($i=0;$i<(count($item1)-1);$i++)
{
$k = $i;
for($j=$i;$j<(count($item1)-1);$j++);
{
if (strcmp($item1[$k],$item1[$j])<0)
$k = $j;
}
if($k<>$i)
{
$temp=$item1[$i]; $item1[$i]=$item1[$k];
$item1[$k]=$temp;
$temp=$item2[$i]; $item2[$i]=$item2[$k];
$item2[$k]=$temp;
}
}

Pretty simple - it works, I get the highest item first - I'd like it
the other way.

But
if (strcmp($item1[$j],$item1[$k])<0) // k an j switched
does not work, though
if (strcmp($item1[$j],$item1[$k])>0) // < replaced by >
does work, but it is descending

How To Calculate Date Difference?
Any one can suggest me how to calculate the difference between 2 dates and it shouldn't be more then 5 years. So pls tell me how to code this?

Day Difference Bettween Two Dates
how to find out the day difference bettween two dates.user inputs both dates.

Getting The Difference Between 2 DATETIME Fields
I have a DATETIME filed in the database that I would like to subtract it from the current time and get the remaining time.

Here is the row in the database:
2007-03-13 05:37:00

I would like to do something like this:

2007-03-13 05:37:00 - CURRENT TIME/DATE = REMAINING TIME

So I am basically trying to get how long it will take for the current date/time to reach 2007-03-13 05:37:00  date/time.

I would like to display it like this:
2 days 5 hours 45 minutes left

Difference Between 2 Time Strings
I am trying to calculate the difference between 2 time strings. e.g:

$time1 = "14:00:03";
$time2 = "12:30:03";

The difference needs to be in hours:minutes:seconds. The 2 times will always be different as they are taken from a database (the 2 times above are just examples of how the time is presented).

Date Time Difference
I have a question similar to another post I see on here about showing arrays. I am trying to break down what nights someone is staying at a hotel.

They choose a start date & end date from drop down menus. (Also, it's in euro format dd-mm-yyyy) I'm not using a timestamp, which I'm afraid may hurt me.

I'm trying to get it to read like this: Code:

Difference Of Two Dates In Seconds ?
How can i find the difference of two dates in seconds ?

Calculate Difference Between Dates
I've to build a function that tells me the resultant date from adding a number of days to a date. Example:

function adddate(date, days) {
     return date + days;
}

For example if I call with this...adddate(2007-05-05, 5) it should give back a 2007-05-10. I've tried but is hard! It should work with any number of days.

Difference Between DocumentRoot(Apache) And Doc_root(php.ini)
I understand what DocumentRoot is but some difficult to understand the needs of doc_root into php.ini.

Example:
www.mydomain.com/pippo.php
The place where pippo.php is searched depends about DocumentRoot.
So what the needs of doc_root?

If I use inside /pippo.php
fopen("/pippo.txt", etc
/pippo.txt is searched under DocumentRoot or under doc_root?

Difference Between Server And System Date
I need to write a PHP code to check the difference between server date and system date.
If the difference is more than 2 days, I will warn the user that his system date might be wrong.

Finding Time Difference Between Two Times.
I want to have a script that reports the last activity that a user had, and stores that in a database. So I'll pass there PHP Sess ID into the URL's, and then update the database with each link they click on.

When they come back later and login again, I need to find out the time difference between the two logins, as I want to give people credits every hour, and don't want to have to run a cron to do this, so instead I just work out the time difference when they relogin and allocate them credits accordingly (its a game). I am no good at working with dates though. There is so many formats - so I wouldn't have a clue which would be the best to use, especially when you want to do calculations with it.

I donno if a MySQL time stamp would be good, as when they relogin the value will be generated with PHP, not from MySQL.

Calculating Time Difference In Seconds?
I need a function to calculate the difference between a supplied date and time and the current date and time, in seconds. Here's what I have: Code:

Difference Between Cached PHP And Zend Optimizer
Does anybody know the performance difference between having your PHP code
cached and just running your code with the zend optimizer? Is there much
difference?

Telling The Difference Between Some $_FILE Array Variables
I have a form that a user fills out to submit a tutorial with maximum of 10 steps. Each step has a spot for 2 pictures to be included but the pictures aren't mandatory. Now, this is what my input fields look like for each step:
Code:
<input type="file" name="media[]" /><br /><input type="file" name="media[]" />

I need to figure out a way to tell the difference between the photos in each step incase the user, for example, submitted 5 steps but only the 1st and 3rd had pictures (when I call the array in the script, the pictures for step 1 would be media[0] and media[1] and step 3 would be media[2] and media[3] which is the exact same as if steps 1 and 5 only had pictures making it impossible to tell the difference between which pictures go with each step).Any ideas?

Date Difference Calc Fails On March
It's fairly simple to find the difference in days from one date to another correct in php? Basically, subtract timestamps and divide by 86400 and apply the floor function to it. But it seems like whatever I try, the difference is wrong when going through March.

Here's an example
3/20 - 4/17
When you count on the calendar, day by day, it is 28 days.
Do a google search for "php date difference calculator" and you will find that nearly all of them return 27 days.

4/17-5-15
When you count on the calendar it is 28 days.
Do a google search for "php date difference calculator" and you will find that nearly all of them return 28 days. I noticed ASP calculators are missing that 1 day somewhere too but javascript calculators work fine. Maybe I'm missing something here.

Telling The Difference Between Zero Rows Returned And Failure
Suppose I make a call to MySql and zero rows come back. How do I tell
the difference between zero rows and failure?


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