Current location: Hot Scripts Forums » Programming Languages » PHP » Firing of nested functions


Firing of nested functions

Reply
  #1 (permalink)  
Old 04-09-10, 02:06 AM
I_have_to_go I_have_to_go is offline
New Member
 
Join Date: Dec 2009
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
Firing of nested functions

I have a question that probably is simple, but here it goes.

When you have nested functions like this:
Code:

              strtolower(trim("    myname    "));
Is the "trim" function fired first, or is the "strtolower" function fired first.
I ask this because I am trying to find out the order of operation in php when you are nesting functions.
Reply With Quote
  #2 (permalink)  
Old 04-09-10, 06:44 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
Reply With Quote
The Following 2 Users Say Thank You to wirehopper For This Useful Post:
I_have_to_go (04-12-10), mysamsung (04-17-10)
  #3 (permalink)  
Old 04-09-10, 07:18 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
You work from the inner to the outer;

So,
PHP Code:

$variable strtolower(trim("    myname    ")); 

would be the same as,
PHP Code:

$variable trim("    myname    ");
$variable strtolower($variable); 
__________________
Jerry Broughton
Reply With Quote
The Following 2 Users Say Thank You to job0107 For This Useful Post:
I_have_to_go (04-12-10), mysamsung (04-17-10)
  #4 (permalink)  
Old 04-12-10, 01:30 AM
I_have_to_go I_have_to_go is offline
New Member
 
Join Date: Dec 2009
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
Thank you all for answering this question for me. I thought that it would fire from the inner most to the outer function, but then I considered how php is a loosely typed language and therefor thought it might do it differently.

Thank You
I_have_to_go
Reply With Quote
  #5 (permalink)  
Old 04-17-10, 05:59 AM
mysamsung mysamsung is offline
Newbie Coder
 
Join Date: Apr 2010
Posts: 22
Thanks: 36
Thanked 0 Times in 0 Posts
thank you...
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem using Mcrypt functions FireflyX PHP 13 12-04-09 12:18 PM
Calculating Age Help jamesbuk PHP 9 03-07-09 01:21 PM
[SOLVED] Functions and references. Nico PHP 4 07-27-07 06:30 AM
can someone help converting perl functions to php functions apophis PHP 0 08-11-06 02:52 PM
Nested Query in PHP/MYSQL truesilentassassin PHP 2 07-27-04 07:50 PM


All times are GMT -5. The time now is 08:13 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.