Learn C or C++ for php extensions

844

I have been programming for a while now in php and want to broaden my knowledge of programming by learning another language whilst hopefully in the process getting better at php also.

One way to do this would be to look at writing extensions for php which would be in c or c++.

Can anyone say which language would be better to focus on for this task?

I know the languages are very similar and that c++ allows for object orientated code but would c be faster and more suited to php extensions?

340

Answer

Solution:

This might help you: http://devzone.zend.com/article/1021 (with more than the answer to you question).

This tutorial assumes basic familiarity with both the PHP language and the language the PHP interpreter is written in: C.

So you can't use C++. If you want to use C++ you should take a look at this article.
Thank you Christoph for pointing this out.

396

Answer

Solution:

The php interpreter is written in C, and the APIs are all in C already. C is the only choice in this case.

Plus, you already know object oriented paradigms from learning php it sounds like, so why not jump into the procedural programming world with C?

People are also looking for solutions to the problem: php - looking to validate US phone number w/ area code

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.