Go Back   Webmaster Forums UK SEO SEM Webmaster Community Forum - UKWW > General > General Webmaster Talk
Register FAQ Members List Downloads Calendar Today's Posts Webmaster Resources Webmaster Blogs
 
 

General Webmaster Talk General webmaster discussion forums - In this forum and its sub forums you can discuss general webmaster related issues or even issues that does not related to Webmastering.
Sub Forums: Running a forum :: Blogs and Blogging :: Word Press Forums :: Digital Photography

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-24-2005, 12:58 PM
ovi
Guest
 
Posts: n/a
Default PHP Tricks - PHP 5 clone in PHP4

PHP 5 handles object differently from PHP4

In PHP4
$new_object = $object;
will copy $object to $new_object

In PHP5
The $new_object will point to $ojbect, kind of like Java.

The correct syntax in PHP5 should be:
$new_object = clone($object);



It's all good but create lots of confusion.
To make the two compatible, here's a clone function that works for both PHP 4 and PHP5:

Code:
/* ************************************** Backward compatible
 */ function php4_clone($object) {
  if (version_compare(phpversion(), '5.0') < 0) {
   return $object;
  } else {
   return @clone($object);
  }
 }
To use the function: $object=php4_clone($old_object); It works on both PHP4 and PHP5

Ovi
Digg this Post!Add Post to del.icio.usStumble this Post!Wong this Post!
Reply With Quote
Reply

Bookmarks



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Webmaster Resources
UK WW SEO Tools
Find UK Hosts
 
The Forum Rules
Forum Rules - MUST READ
 
Site Of the Month
BizzFace
Nominate site of the month
 
Tag Cloud
43. wholesale adsense ready apple iphone 16gb apple iphone 16gb 3g articles article writer australia web hosting beauty cash casino cheap clothes communications content custard media database dgital camerals domain name english teacher fantasy football fantasy football league fittness football league free handbags home income instant jewelry links link sale medical health money money making online music natural health news nokia n96 16gb one way links online online shop poker professor quality links replica sam allcock seo social networking sony vaio laptop sunglasses technology the medical plus themes tutor verbalized wallet wallets wanted web hosting widget ready wordpress xmas offer

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DMOZ Clone directory a waste of space? temi Directories 19 05-17-2005 07:32 AM
SEO tips and tricks martian2k4 General Search Engine Discussions 3 04-07-2005 06:56 PM
more html tricks crowebird General Webmaster Talk 20 10-03-2004 05:26 AM
2 html tricks... crowebird General Webmaster Talk 2 09-12-2004 05:48 PM
blank screen (linux+php4.3.3+Apache/1.3.28) still a problem czlowiek iG Shop 0 02-12-2004 08:31 PM


All times are GMT. The time now is 08:57 AM.

UK Webmaster World Forums - Internet marketing, web development, domain names, SEO contest and discussuons.
Subscribe to our feeds   Subscribe to our feeds

Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0