View Full Version : PHP vs PERL


system_eyes
Hello friends,

well, i have finished HTML and i am is about to finish C ,
now i am thinking in starting in a new language so i wana know which is stronger in internet application PHP or Perl or ASP
?

mohamed
You should ask
perl or PHP ?

system_eyes
hi mohamed,
i guess u wana say that PHP and perl are the best ,
now tell me which is the best ?

how was ur meeting there? ;)

m0h
What he was trying to say as I think is ASP has nothing to do with linux (even you can now run some asp scripts under linux)
ASP .NET is great (I never used it & I think I will not).
PERL is very strong, but I don't like it :) its not easy .
PHP which I think is the best, is very easy and powerful.

Since you know C go with PHP, you will find it almost the same! ;)

What meeting? :rolleyes:

uniball
Windows lusers should stick to php ;-)

m0h
lusers :D
Its know that PHP is best on linux ;)

uniball
Originally posted by m0h
lusers :D
Its know that PHP is best on linux ;)
hmmmm
Did i say that php is incompatible with GNU/Linux ??
Sorry! it's not the best, Zope rocks them all!

angoranimi
PHP is incompatible with GNU/Linux? Enlighten us, uniball!

m0h
Originally posted by uniball

hmmmm
Did i say that php is incompatible with GNU/Linux ??
Sorry! it's not the best, Zope rocks them all!
wrong!
The best of the best is LAMP (Linux, Apache, MySQL, PHP)
Which is 4 sure compatible with GNU/Linux!

uniball
Let's follow the thing from the beginning:
me: Windows lusers should stick to php ;-)
m0h: Its know that PHP is best on linux
me: Did i say that php is incompatible with GNU/Linux ??

I Hope that you both understand the meaning, That is: I didn't say that php won't work on GNU/Linux.

alaa
did you try ZOPE before??

system_eyes
Originally posted by uniball
Windows lusers should stick to php ;-)
why do i have the feeling that i am doing a crime by using windows.:D

i wonder if perl will not work under windows?
second , what is ZOPE?
third, till now noone replied to my question in which i wana know which is strongest asp or PHP or perl?

forget about lusers when replaying:D

uniball
> why do i have the feeling that i am doing a crime by using windows.
What is a windows user doing in a LUG ?

> i wonder if perl will not work under windows?
It'll but with limitations, No file locking, No fork "dono if there is
something else"
So you have to implement your own file locking mechanism "UBB did this till the
last time i've checked their code"

I know nothing about php but i'm sure it'll work under the crappy platform you
are using since it's a crappy language.
> second , what is ZOPE?
www.google.com

> third, till now noone replied to my question in which i wana know which is
> strongest asp or PHP or perl?
I think that
aratux's reply was:
"
You should ask
perl or PHP ?
"
What do you think ? You are the main reason for a flame war now ;-)

SYStems
Okay ...
my not so educated opinion

zope is an application server ...

it's provide you with a framework to design the webapp

there are many different frameworks and application servers
each with it's strenght and weakness

the framework used with perl is called CGI, it is said that CGI is old technology and does not provide good ways to manage very larger website

PHP , even tought considered to be a lot poorer
language then perl , comes with a better framework (just think that a framework is a way to organize your app), that is why u will hear that php is easy and such , but also it is said that php does not scale (will be hard to use) for very large websites

now zope is another framework (the application server is part of it) that rely heavily on python (even tought python is not the only lang u can use , u can use perl too)

now, it's also know, that very large website (ebay) use java and the j2ee framework

now since u are mostly generally interested in
learning a new lang that will help u build web apps

the conclusion is
perl is dead

php is popular but not really the best there is

python is very nice to learn very powerfull but zope is not really populare or widely used

i think python would interest u the most since its OO (object oriented, c isnt , perl tries to be same for the new php, but python OO model is the best)
it's also fun to learn

now , so that no one bites me, i never used any of those , but i am confident in that i said i not wrong

and on a side note
uniball , what do u mean by " No file locking , no fork" ???

uniball
> the conclusion is
> perl is dead
Thanks Mr. Larry Wall for pointing this.

> perl tries to be same for the new php,
What's that ? It's not true, Please clarify

> uniball , what do u mean by " No file locking , no fork" ???
You can't use fork()
no flock() also, So you can't lock the opened file and thus any number of processes can access it and lead to corruption.

BTW: If you are a good programmer, You'll hate php from the first look in the reference manual!

SYStems
Originally posted by uniball
> the conclusion is
> perl is dead
Thanks Mr. Larry Wall for pointing this.

:o
i was repeating a popular opinion, that perl is
dead for web app, most ppl now use php for small
website, java for large one !


> perl tries to be same for the new php,
What's that ? It's not true, Please clarify


i mean that both perl and php have OO feature
but i read they are very badly implement
python was OO from since it started thus python OO features make more sense better implemented etc...


> uniball , what do u mean by " No file locking , no fork" ???
You can't use fork()
no flock() also, So you can't lock the opened file and thus any number of processes can access it and lead to corruption.


thanx

joe_lite
What is a windows user doing in a LUG ?
i think there is no problem to use both platforms, actually i cannot live isolated with some good friends , ithink the bad guys have a place in my life too
perl is dead
it's not dead but the number of new application in it is decreasing in favour of Php as it is more easy and more c like
lusers what does it mean?
Did i say that php is incompatible with GNU/Linux ?? i agree to some extent due to the recent changes in php license
ASP .NET is great i agree with that too and fourtunly there is an opensource implementation (Mono)

finally i vote for PHP

system_eyes
Originally posted by uniball
>
What do you think ? You are the main reason for a flame war now ;-)
well man, i dun wana be rude with u actually,so becarefull when u are talking to me, what is ur problem ??!!

the strange matter that i have talked to mohamed before (admin)
and he ensured that this site is set to help his country people,
now i wonder why all this limitation on windows
the one who master windows is good,the one who master linux is better , the one who master both is the best .

listen uniball , i am not in need to use this board actually, i am already member in several boards in the internet , all the matter that i peffered to be here with my countrey people that i belong to, and i am not ready to hear such a thing from u

angoranimi
Linux is free. This board is free (atleast for us). You are free too. You're welcome if you want to stay, but you have the freedom to disappear if you opt to (pity though, we were hoping we can increase the linux user-base in egypt).

About PHP not scaling, that is SO not true. PHP is alot more scalable than Java. Trust me. Dude, do you have a clue how much overhead a java applet has? Personally, I loathe java. Sun is starting to be so much like Microsoft... anyways, don't get me started about that.

PHP's documentation sucks? What are you talking about? Will you please point me to a URL and show me how it sucks?

PERL will not die. Not now anyways. Atleast, it will outlive Larry (and probably you and me).

uniball
joe_lite:
> i think there is no problem to use both platforms.
Agree, But when you are only using windows ? Is it resonable to be found in a
LUG ?

> i agree to some extent due to the recent changes in php license
I meant that it's compatible for sure. Still no one got it !!! "was it a mistry :-)"


system_eyes:
> well man, i dun wana be rude with u actually,so becarefull when u are talking
> to me, what is ur problem ??!!
It's your problem not mine!!
Do you know what a flame war is ? It's nothing that makes you a bad guy
http://www.catb.org/~esr/jargon/html/F/flame-war.html

> the strange matter that i have talked to mohamed before (admin)
> and he ensured that this site is set to help his country people,

And that's what i'm doing here.

> now i wonder why all this limitation on windows
Because this is a LUG "Linux User Group" Not a windows user group. There is
76487538963580973659 egyptian sites about Windows But ONLY 1 "ONE" about
GNU/Linux, If we turn this site to a windows site, Now tell me what's gona
happen ?
You don't know how many here were happy to find a lug here in egypt, You can't
imagine that i've used Linux 2 years before i find Linux Egypt.
And i was completely isolated till i've found other GNU/Linux users.

> the one who master windows is good,the one who master linux is better , the
> one
> who master both is the best .
That's you opinion.
I've never heard a LUG talking and discussing windows issues like we are doing
these days. Are we turning the forum into a windows forum or what ??

> listen uniball , i am not in need to use this board actually, i am already
And i'm not in need to you, You are not my boss or father, And i didn't swear
at you personally.

> member in several boards in the internet , all the matter that i peffered to be
That's not a board for your country ppl, That's for your country ppl using
GNU/LINUX

> here with my countrey people that i belong to, and i am not ready to hear
> such a thing from u
And i don't have much time to spend with you, I have many problem to solve, And
i feel more good when i help anyone then just spending time with a windows
user.
You may have a look here:
http://www.catb.org/~esr/jargon/html/L/luser.html
http://www.catb.org/~esr/jargon/html/L/loser.html

And finally yes! What windows ONLY users are doing here ? What windows related
topics are doing here ?

I'm ill and i want to sleep, Maybe i won't wake up "or that's what i hope".

uniball
Originally posted by angoranimi
PHP's documentation sucks? What are you talking about? Will you please point me to a URL and show me how it sucks?


Not the documentation
but have a look here:
http://www.php.net/manual/en/control-structures.alternative-syntax.php
Tell me: Is it really "and honestly as expect from you" logical to expect the output of the last 2 examples as it should be ??

Another thing: Why do i have a thousat ways to declare an array !!

angoranimi
To save time, I'll only discuss the last example.

Basically, this is "the dangling else" problem. Its simply a syntax thing. This particular example shows two ways to write an if () statement. The first way, which is this:

[CALL THIS SYNTAX1]

if ($1 == "-ae"):
echo hi;
endif;

Works exactly like this:

[CALL THIS SYNTAX2]
if ($1 == "-ae") {
echo hi;
}

So, if you put an if then an ELSE into that block, its only logical that it will try to parse the SECOND else in that block using the same syntax the first if in that block is written in.

So if you write an "if" using syntax1, and its dangling else in syntax2, it will give you a syntax error. Logical.

Now, I don't see why all the different ways to do the same thing is causing you problems. Remember that PHP borrows some of its stuff from the Zend engine, which I'm quite sure causes more than one syntax for the same thing.

Why don't I see you complaining about this (in C):
variable = x > 1? y : z;

eh? Thats only one example, I'm sure there are alot more.

Just stick to the syntax you like, and ignore the rest. Thats what I do. You're not required to be a walking PHP manual (or a walking <put your fav language here> manual).

Secondly, remember that PHP is a high level language. Bye bye *alloc()'s; now all memory allocations are implicit. So if you, in the middle of no where (in PHP), do a:

$love[8] = 96;

It will automatically create an array of 8 variables (or atleast, pretend that it did). Again, you don't need to know the 20 million ways of declaration. Choose the one you like, and stick to it.

uniball
I can say that i've got your idea, Though browsing other ppl code'll be somehow hard but that's the beginning.
Then it's the problem with the Zend engine after all.

But i still admire perl ;)

$love[8] =96 ;
memory things like this can be avoided in C++ !!!!

but consider this:

<? if (condition_is_trye) { ?>
<html code here>
<? } else { ?>
<another code here>
<? } >


Sorry, I don't think that printing only the 1st HTML block and not the second
is the brilliant way, as bth blocks are not in php code.

sweet dreams :)

angoranimi
I find it logical.

Whats the purpose of the if/else when you're planning to print both HTML blocks?

And how are you planning to do a array[8] = 69; in C++? They can be an array of objects with an operator overloaded function for '=', but how are you gonna malloc()/new the base array with out "array = new object[8];"?

Refresh my OOB memory.

uniball
The logical thing to me is that the whole code + HTML be between <? & ?>

!!WARNING!!
i'm not a C++ programmer

Maybe it can be done if you overloaded the [] operators.
though i'm not sure, And it'll not be The Right Thing (TM)

alaa
I don't care much for PHP, in fact I hate PHP but thats I'll just defend C/C++ a bit here and lave the PHP bashing to others.

>variable = x > 1? y : z;
actualy, although this may seem like a redundant thing it is not, this is not just syntatic sugar and/or cruft this the ?: operator and the if statement are totaly different beasts, their difference and their existance fits neatly with the design and general philosophy behind both C and C++.

the difference is namely that the construct (x ? y : z) is an expression, while the construct if {} else {} is a statement or a code block.
an expression evaluates to a certain value a statement doesn't, an expression can be used in places where statements cannot be used (and there are things that cannot be directly done with the expression).

for instance, if you have a constructor and you want to conditionaly assign some value to a certain data member you can say


Foo::Foo(int x) : m_x( x ? new int[x] : NULL) {}


without a conditional expression you would have to move the assignment to the body of the constructor, this may not be possible if for instance the object you wanted to initialize did not have a default constructor.
you will be forced to either use pointers when you don't really need them or to force all objects to have default constructors, in both cases you'll be completley breaking the more abstract/philosophical aspects of C++ programming (namely the rule resoursce acquisition is initialization).

>And how are you planning to do a array[8] = 69; in C++?
easy, you just create your own array container and overload the [] operator.

so you could for instance have


template <typename T>
T& Array<T>::operator[](size_t idx) {
if (idx<size) return m_data[idx];
else {
m_data.resize(idx+1);
return m_data[idx];
}
}


you could also have the pretend you have the extra elements thing by encapsulating array elements in a special class (or handler) with special assignment operators.
if it wasn't possible we wouldn't have an associative array in the standard library (the map class).
this is all very common in modern C++ code, and of course client code does not need to worry about the implementation details at all, so actually C++ can be used as a very high level language just like PHP as long as you use good libraries.

> About PHP not scaling, that is SO not true. PHP is alot more scalable than Java.

I'm more of a Java hater than a PHP hater, but when you compare PHP's scalability don't compare it to a normal Java environment compare it to a JSP one (I hear they scale very well).

cheers,
Alaa

mohamed
Originally posted by uniball
The logical thing to me is that the whole code + HTML be between <? & ?>


Sure it could be.
Just use echo and put the HTML you want.
There are many ways to do anything !!
Personally, I like to put the HTML outside the php tags.

Personal preferences after all.

Regards
Mohamed Eldesoky

alaa
what is that dumb vbscript adding smilies inside code tags for??

SYStems
Originally posted by alaa
>variable = x > 1? y : z;
actualy, although this may seem like a redundant thing it is not, this is not just syntatic sugar and/or cruft this the ?: operator and the if statement are totaly different beasts, their difference and their existance fits neatly with the design and general philosophy behind both C and C++.

the difference is namely that the construct (x ? y : z) is an expression, while the construct if {} else {} is a statement or a code block.
an expression evaluates to a certain value a statement doesn't, an expression can be used in places where statements cannot be used (and there are things that cannot be directly done with the expression).

for instance, if you have a constructor and you want to conditionaly assign some value to a certain data member you can say


Foo::Foo(int x) : m_x( x ? new int[x] : NULL) {}


without a conditional expression you would have to move the assignment to the body of the constructor, this may not be possible if for instance the object you wanted to initialize did not have a default constructor.
you will be forced to either use pointers when you don't really need them or to force all objects to have default constructors, in both cases you'll be completley breaking the more abstract/philosophical aspects of C++ programming (namely the rule resoursce acquisition is initialization).



Okay , i am not excatly disagreeing
but, it's more like i want to add few things
or simplify what you just said

you can almost always replace any expression with a function
z = a + b ; // #1
is the same as
z = add( a, b) ;

same thing logically, they will always give u the same result, alwaysssss

the only difference is internal to how the code works
z= add(a,b) ; involves a function call which will
probably (or dare i say should) take more resource to execute

z= a+b ; probably translate to more efficient code

thus , you can always , always always always
incapsulate the if else statement in a function, and make it look
or give excatly the same result as the ternary operator , with the added pluses of better readability and flexibility of the if else statements and functions

the drawbacks are purely technical, which is where i disagree with alaa, alaa think it help expressiveness.
the drawbacks are:
1) defining a functions , which reserve a name for it self (i dont think this would be much of an issue in c++ )
2) making a function call, which is slower

anyway many ppl encapsualte ternary operators in macros, which make ternay expressions look like function calls

functions that return values are expressions

functions that dont return a vlaue are statements

again i dont disagree that ternary operators are usefull, espacially when combined with macros

i just dont think it have anything to do with abstract c++ philosophy stuff !!

system_eyes
Originally posted by uniball
I've never heard a LUG talking and discussing windows issues like we are doing
these days. Are we turning the forum into a windows forum or what ??
well, if u have an eyes to see, my question was about perl or Php.
may be u are in need to see a doctor.

Originally posted by uniball
And i'm not in need to you, You are not my boss or father, And i didn't swear
at you personally.
yeah true, the same here .and i didn;t ask u to be ur boss.

Originally posted by uniball
And finally yes! What windows ONLY users are doing here ? What windows related
topics are doing here ?
[/B]

now tell me where is the related topic as we were making a discussion on
perl or Php.
are u sick or somehow?

i didn;t like to post that really but ur way in talking led to this, may be am the one who should say i dun work for u

mohamed
Originally posted by alaa
what is that dumb vbscript adding smilies inside code tags for??

When posting a message, do you see that check box named (Disable Smilies in This Post) ??

Regards
Mohamed Eldesoky

angoranimi
>variable = x > 1? y : z;
actualy, although this may seem like a redundant thing it is not, this is not just syntatic sugar and/or cruft this the ?: operator and the if statement are totaly different beasts, their difference and their existance fits neatly with the design and general philosophy behind both C and C++.


What I meant was they can be used redundantly, thus cause Readability issues, what uniball was complaining about.

What I'm trying to say is being a higher-level language (than C), its okay to have different ways of saying the same thing (exactly the way it is in English). Just stick to the way you like and you will be okay. However, most people do stick to the standard methods. I've never seen anyone use the if (): endif; syntax (yet).



template <typename T>
T& Array<T>::operator[](size_t idx) {
if (idx<size) return m_data[idx];
else {
m_data.resize(idx+1);
return m_data[idx];
}
}



templates.. never really played with them. Neato though.

uniball
#include <snip.h>

> now tell me where is the related topic as we were making a discussion on
> perl or Php.
> are u sick or somehow?
IO said windows lusers should stick to php and there was a reason. Go read about perl incompatibilities with Windows and you shall see.
Now you are the one who is sick, You switched the topic away from the original topic..


I'm not going to reply to the other parts. Though i really can!

alaa
> What I meant was they can be used redundantly, thus cause Readability
> issues, what uniball was complaining about.

yeah but my point was that they are not there just for redundancy, while things in PHP tend to be just that.

there is absolutley no value in having alternative syntax and function aliases in PHP except to please everyone's syntatic taste.

>When posting a message, do you see that check box named (Disable
>Smilies in This Post) ??

yeah I see that, but I thought the function of the code tag was to bypass all formatting.

>thus , you can always , always always always
>incapsulate the if else statement in a function, and make it look
>or give excatly the same result as the ternary operator , with the added
>pluses of better readability and flexibility of the if else statements and >function

true, you can always use funtions when you need expressions, the functioncall overhead thing could be solved by using inline (in C++) and a macro in C.
but since an if else statement in expressions is sooo commonly used you had to have a solution in the standard language, the three choices where.

make if statements an expression.
make a new function.
make a new operator.

they chose the third one, it might not be the best choice (t introduces an anomaly in the operators syntax and it cannot be overloaded in C++), but it is now the standard way to do things.

>i just dont think it have anything to do with abstract c++ philosophy stuff !

thats where we disagree, I could easily write a pow() function myself, however since it is such a widely used thing it goes into the standard language itself.
so its the same here, an if else expression fits neatly with the language design and philosophy and stuff.
so it was needed redundancy, it had a point (although this point may have been served better by a function instead of the operator).


>templates.. never really played with them. Neato though.
its not the templates that do the dynamic expanssion thing here, but anyway you should learn templates generic programming is one of the most exciting things to happen is CS recently.
its basically why I can't stand using languages other than C++, Python and Lisp it is impossible to do generic programming with the rest.

cheers,
Alaa