Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 819 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

OOP for a PHP Newbie

Thread title: OOP for a PHP Newbie
Closed Thread  
Page 2 of 2 < 1 2
    Thread tools Search this thread Display Modes  
08-24-2007, 09:38 PM
#11
epixal is offline epixal
Status: Junior Member
Join date: Jul 2007
Location:
Expertise:
Software:
 
Posts: 43
iTrader: 0 / 0%
 

epixal is on a distinguished road

  Old

haris' reply was deleted.

08-24-2007, 09:44 PM
#12
Haris is offline Haris
Status: Request a custom title
Join date: Dec 2005
Location:
Expertise:
Software:
 
Posts: 2,741
iTrader: 9 / 100%
 

Haris is on a distinguished road

  Old

Sorry for the confusion. Please re-read my post.

08-24-2007, 09:48 PM
#13
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

Originally Posted by Haris View Post
How do you get conditional statements between classes(functions)?

Example:

PHP Code:
    public function oneYearPasses(){
        
$TheHeight $this->_Height++;
        
$return_val 'The '.$this->_Type.' Tree grows to '.$TheHeight.' meter <br/>';
        return 
$return_val;
        
        if(
$TheHeight == 10){
            
$return_val '<b>Your Tree is now mature and grows 10 fruits</b>';
            return 
$return_val;
            
$this->_Fruit 10;
        }
    } 
The if statement doesn't return the value when reaches to 10 meters.
This is because you arent calling the variables correctly, its $this->variable, not $this->_variable

edit:
Plus the if statement will never be executed because
PHP Code:
        return $return_val
is not in a conditional statement, therefore no code below it will run.

08-24-2007, 10:18 PM
#14
Haris is offline Haris
Status: Request a custom title
Join date: Dec 2005
Location:
Expertise:
Software:
 
Posts: 2,741
iTrader: 9 / 100%
 

Haris is on a distinguished road

  Old

Originally Posted by Village Idiot View Post
This is because you arent calling the variables correctly, its $this->variable, not $this->_variable

edit:
Plus the if statement will never be executed because
PHP Code:
        return $return_val
is not in a conditional statement, therefore no code below it will run.
Thanks Village.

08-25-2007, 12:11 AM
#15
creativejen is offline creativejen
Status: Paladin
Join date: Jul 2006
Location: Sheffield, UK
Expertise: design, front-end markup
Software: Photoshop
 
Posts: 2,353
iTrader: 25 / 96%
 

creativejen is an unknown quantity at this point

Send a message via MSN to creativejen

  Old

I'm sorta in the same situation as haris, assuming he is very knowledgable with php but not with in coding oop. I've been looking for a decent explanation for quite a while, finally its here!

I'll probably shoot a few questions over to you village soon

Thanks!

08-25-2007, 12:15 AM
#16
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

I am extremely thrilled my tutorials are clear, I will continue adding things to it.

08-25-2007, 09:28 AM
#17
Haris is offline Haris
Status: Request a custom title
Join date: Dec 2005
Location:
Expertise:
Software:
 
Posts: 2,741
iTrader: 9 / 100%
 

Haris is on a distinguished road

  Old

Originally Posted by Village Idiot View Post
I am extremely thrilled my tutorials are clear, I will continue adding things to it.
I'd like you to cover how to validate posted data. Apart from that security.

08-25-2007, 01:47 PM
#18
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

Originally Posted by Haris View Post
I'd like you to cover how to validate posted data. Apart from that security.
I have an article on how to secure data here http://www.talkfreelance.com/thread37178.html

08-25-2007, 07:25 PM
#19
Haris is offline Haris
Status: Request a custom title
Join date: Dec 2005
Location:
Expertise:
Software:
 
Posts: 2,741
iTrader: 9 / 100%
 

Haris is on a distinguished road

  Old

Originally Posted by Village Idiot View Post
I have an article on how to secure data here http://www.talkfreelance.com/thread37178.html
Why do you use cookies instead of sessions? Any particular security reason?

Closed Thread  
Page 2 of 2 < 1 2


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed