|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
Message Moved
Thread moved from 'PHP Coding' to 'Programming Theory' by Andrew.
Reason: |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
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:
Is that correct or is there something i missed? And if this is true doesn't it give problems with older written programs? |
|
#5
|
||||
|
||||
|
RE: PHP 5 ?
This is only true for objects, not variables in general. ints, strings, etc. still behave as they always have.
|
|
#6
|
|||
|
|||
|
RE: PHP 5 ?
Aaah ok then there wont be much problems ;)
Thanks for the info. |
|
#7
|
|||
|
|||
|
RE: PHP 5 ?
mmmm... i don't understand aabout to php object
|
|
#8
|
||||
|
||||
|
RE: PHP 5 ?
check out - http://blog.libssh2.org/index.php?/archives/51-Youre-being-lied-to..html
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Programming Theory > PHP 5 ? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|