?

Log in

No account? Create an account
DEAR LORD! Php has some things that I call syntactic sugar! However,… - The tissue of the Tears of Zorro [entries|archive|friends|userinfo]
tearsofzorro

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

[Jun. 23rd, 2005|05:55 pm]
tearsofzorro
[Tags|, ]

DEAR LORD!

Php has some things that I call syntactic sugar! However, looking at some of this crap is insanely painful!

Conditional functions are one example. And for some reason, I just wonder why it's there?

Ugh, it's evil. I want to learn this language, but by god it looks evil!

Take care,
Aoife
linkReply

Comments:
[User Picture]From: ebel
2005-06-24 05:08 pm (UTC)
Conditional functions? What are they? Can you giove an example?

I've always though PHP was basically like C, just trying to look like perl. Perl has all these quirky ways of doing things that allows you to eave out stuff and mess with the code (just look at some of greg's stuff), whereas PHP seems to throw out all of that and behaves a bit like C (without all the BDS&M stuff).
(Reply) (Thread)
[User Picture]From: tearsofzorro
2005-06-24 06:15 pm (UTC)
Conditional functions are functions written inside other functions. That function cannot be called until the function that contains it is executed. It's on the first page of the section on functions in the php manual.

There's apparently a lot of odd things you can do with them. The more I look at php on any level, the more it reminds me of perl, but possibly with better object support.
(Reply) (Parent) (Thread)
[User Picture]From: ebel
2005-06-24 07:59 pm (UTC)
Didn't know about those conditional functions. I wonder if PHP is lexically scoped... One advatage I can see is that you could try having something like:
function foo($num)
{
  function bar($blah)
  {
   return $num+$blah
  }
}

That way you can call foo with some number and hence change what bar does. Hmm I wonder what happens if you were to call foo again.

Anywya fancy stuff like this is why I like high level languages like perl, python and lisp. They allow you to change the code at run time. :)
(Reply) (Parent) (Thread)
[User Picture]From: granite_lullaby
2005-06-25 02:23 am (UTC)
I'm sorry, but I must say how adorable I find your functions XD
(Reply) (Parent) (Thread)