Kahuki Webmaster Forum  

Go Back   Kahuki Webmaster Forum > Website Development & Management > Programming > PHP

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-01-2007, 05:54 AM
prevo's Avatar
Member
 
Join Date: Jul 2007
Posts: 72
prevo is on a distinguished road
in php if i have a class that returns a value say: return $val, how do i use this value in the php program?


I know vb, and I have used classes before, and Matt S, what you are saying is correct, but I couldn't apply it to php.
Would it be correct to say that what the dot is in vb is -> in php?

Reply With Quote
  #2 (permalink)  
Old 06-01-2007, 05:59 AM
Rookie
 
Join Date: Jan 2006
Posts: 2
Nulle is on a distinguished road
// In root of program
$class = new Class();

$useVal = $class->method();
// useVal now equals returned val

Reply With Quote
  #3 (permalink)  
Old 06-01-2007, 06:06 AM
Rookie
 
Join Date: Sep 2006
Posts: 2
Mitchell is on a distinguished road
Sounds like you mean you have a method of a class that is returning a value. So here is an example:

function GetNumber(){
$val = 15;
return $val;
}

To use this function you first create a variable then assign the return value of the function to the variable:

$returnedValue = GetNumber();

After execution, $returnedValue will now be equal to 15.

What is being returned is whatever is in $val... not $val itself. It IS possible to get a reference to $val but I don't think that is what you are getting at so I won't go there.

Reply With Quote
  #4 (permalink)  
Old 07-29-2007, 09:22 PM
Rookie
 
Join Date: Jul 2007
Posts: 23
anow2 is on a distinguished road
Send a message via MSN to anow2
Im sorry for my noobiness, but what is a Class?

I just started PHP 3 days ago btw xD

Reply With Quote
  #5 (permalink)  
Old 08-27-2007, 01:48 AM
brandrocker's Avatar
Member
 
Join Date: Aug 2007
Location: India
Posts: 56
brandrocker is on a distinguished road
PHP Classes are the same as that of the classes in C++
You can read this.

http://in2.php.net/manual/en/language.oop5.basic.php

__________________
Its About Web Hosting
Search, Discuss and Choose the perfect host

Reply With Quote
  #6 (permalink)  
Old 11-13-2007, 09:33 AM
Rookie
 
Join Date: Nov 2007
Posts: 4
HeeL is on a distinguished road
Send a message via ICQ to HeeL Send a message via Skype™ to HeeL
anow2, if you want to learn classes in PHP, you must to use not PHP3. Download the latest version of PHP5. And read the book))

__________________
http://HeeL.org.ua - My web-site
http://doua.com.ua - My web-board

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Used "caging evidence" as a search on yahoo NEWS page, not websearch. Has return #5 been concealed/ no vote? sai14 Yahoo! 1 06-02-2007 04:00 PM
Book title: about a man who writes a book about his home town and has to return and face them at a funeral? __Danny General Discussions 1 02-16-2007 03:42 AM
How do I define class constants in php5? Hawk PHP 3 01-06-2007 01:03 PM
yahoo search marketing class? Raphs Pay-Per-Click Marketing 1 08-25-2006 02:47 AM
java query : My prog is giving an error while running java class , pl help !? pepecito Programming 4 07-24-2006 11:15 AM


All times are GMT. The time now is 04:47 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0