Programming Theory
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesProgramming Theory

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
  #1  
Old January 3rd, 2007, 09:54 PM
MysticFist MysticFist is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 34 MysticFist User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
PHP 5 ?

Hi,

I just bought a book about php 5 and it seems that now when you pass a variable, you pass it's adress instead of a copy of his value.

4.x -> pass value
5.0 -> pass adress

Wont that give problems if we try to run applications that were written for lower php version?

I know they always say that it should continue to work but i have a doubt about this one.
I think it might give some results we don't expect.

Reply With Quote
  #2  
Old January 3rd, 2007, 10:18 PM
System System is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Posts: 665 System User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Message Moved

Thread moved from 'PHP Coding' to 'Programming Theory' by Andrew.

Reason:

Reply With Quote
  #3  
Old January 3rd, 2007, 10:34 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: PHP 5 ?

I assume that you are talking about passing arguments in function calls?

To pass an argument by reference (address) you must prepend the & to the argument name in the function definition. Not doing this passes the argument by value (in all versions of PHP.)

Therefore, there is different syntax for a function definition for passing an argument by value and by reference.

Reply With Quote
  #4  
Old January 4th, 2007, 10:27 AM
MysticFist MysticFist is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 34 MysticFist User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: PHP 5 ?

Ya i know that you have to place & in front of the variable to pass it's adress in php 4 BUT it seems that now it has chanced.
In php 5 is seems you give always the adress instead of the value.
I read that you have to use the clone command now to copy a variable also to avoif that 2 variables are the same.

In php 4:
-------------------------------
$a = 1;
$b = $a;
$b = 2; // $a is still 1

In php 5:
-------------------------------
$a = 1;
$b = $a;
$b = 2; // $a is 2 now !

To get the same result as before we need to do this:

$a = 1;
$b = clone $a;
$b = 2; // $a is 1 now

I have read that in the book i just bought but as it is in dutch i can't show it to you guys but look at the following i quotes from that website:

http://www.zend.com/php5/andi-book-excerpt.php

Quote:
In PHP 5, the infrastructure of the object model was rewritten to work with object handles. Unless you explicitly clone an object by using the clone keyword you will never create behind the scene duplicates of your objects. In PHP 5, there is neither a need to pass objects by reference nor assigning them by reference.


Is that correct or is there something i missed?
And if this is true doesn't it give problems with older written programs?


Reply With Quote
  #5  
Old January 4th, 2007, 10:34 AM
honcho's Avatar
honcho honcho is offline
Contributing User
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Cape Cod
Posts: 1,347 honcho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 2 sec
Reputation Power: 3
RE: PHP 5 ?

This is only true for objects, not variables in general. ints, strings, etc. still behave as they always have.

Reply With Quote
  #6  
Old January 4th, 2007, 03:31 PM
MysticFist MysticFist is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 34 MysticFist User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: PHP 5 ?

Aaah ok then there wont be much problems ;)
Thanks for the info.

Reply With Quote
  #7  
Old January 29th, 2007, 02:01 AM
nosferatu_akima nosferatu_akima is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Bolivia
Posts: 1 nosferatu_akima User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: PHP 5 ?

mmmm... i don't understand aabout to php object

Reply With Quote
  #8  
Old February 2nd, 2007, 08:18 AM
lig's Avatar
lig lig is offline
"Forum Nazi"
Codewalkers Demi-God (4500 - 4999 posts)
 
Join Date: Apr 2007
Location: Jacksonville, Fl
Posts: 4,719 lig User rank is Private First Class (20 - 50 Reputation Level)lig User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 4 m 29 sec
Reputation Power: 6
RE: PHP 5 ?

check out - http://blog.libssh2.org/index.php?/archives/51-Youre-being-lied-to..html

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesProgramming Theory > PHP 5 ?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway