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:
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: 12
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
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: 12
Message Moved

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

Reason:

Reply With Quote
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,308 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 34
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
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: 12
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
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: 13
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
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: 12
RE: PHP 5 ?

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

Reply With Quote
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
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,774 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 15 h 13 m 9 sec
Reputation Power: 16
RE: PHP 5 ?

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

Reply With Quote
Old February 4th, 2013, 12:05 AM
kevinloyed kevinloyed is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 17 kevinloyed User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 56 m 38 sec
Reputation Power: 0
php5 is the last version of the programming language php, which the
plugin is written in. You should check with your host if he can
install or activate it for your server/website.

Reply With Quote
Old February 4th, 2013, 12:52 PM
IAmALlama IAmALlama is offline
Me
Click here for more information
 
Join Date: Apr 2007
Location: San Diego, CA
Posts: 2,290 IAmALlama User rank is Lance Corporal (50 - 100 Reputation Level)IAmALlama User rank is Lance Corporal (50 - 100 Reputation Level)IAmALlama User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 11 h 30 m 57 sec
Reputation Power: 14
new record for resurrecting an old thread?

Reply With Quote
Old March 18th, 2018, 09:18 PM
besttodolistapp besttodolistapp is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Mar 2018
Posts: 1 besttodolistapp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 20 sec
Reputation Power: 0
I assume that you are talking about passing arguments in function calls?

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesProgramming Theory > PHP 5 ?


Developer Shed Advertisers and Affiliates


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


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


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap