Solved

Getting Ready for a PHP position.

Posted on 2006-11-30
29
325 Views
Last Modified: 2008-02-01
I've got an interview with an IT firm for a PHP/Java position.

I want to be ready.

What areas of PHP should I be fluent in? How can I prepare? I'm an intermediate with PHP.

0
Comment
Question by:weikelbob
  • 10
  • 8
  • 5
  • +3
29 Comments
 
LVL 8

Assisted Solution

by:jk2001
jk2001 earned 100 total points
ID: 18051685
Probably learn how to call Java from PHP.
0
 
LVL 7

Author Comment

by:weikelbob
ID: 18051913
That's a good idea.

What else?

I'd like to know the areas of PHP which are most usually expected for a PHP programming job.
0
 
LVL 15

Assisted Solution

by:babuno5
babuno5 earned 100 total points
ID: 18051972
check this url it has a good set of php questions
http://www.sitepoint.com/forums/showthread.php?t=439118
0
 
LVL 29

Assisted Solution

by:TeRReF
TeRReF earned 100 total points
ID: 18052020
- PHP/ Database interaction
- String manipulation
- Optimilazation of code
- IF they're using PHP5 especially, OOP
- Code seperation (using template egines like Smarty (smarty.php.net))

TO name a few :)
0
 
LVL 7

Author Comment

by:weikelbob
ID: 18052094
What string manipulation aspects do I need to know?

Also, should I open a separate question for each area I need to talk to you guys about?
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 18052182
Well, string manipulation is one of the strengths of PHP. THere are loads of functions (as you know) that can make life easy for you. It's just a matter of combining those functions in a proper way.
It's not a matter of knowing all the ins and outs of every string function, what params they require etc. It's more a matter of knowing what function you could use for a certain task. (the phpdocs will provide you with the ins and outs at all times :)

So, knowing how to use the phpdocs is vital to being an inventive programmer.

Asking what string manipulation aspect you need to know is a very hard question to answer. It's better to read through the phpdocs on the matter:
http://php.net/strings

You're already an intermediate PHP programmer, so you've been working with string for quite some time. You will know what kind of string manipulation you use most of the times. It won't be much different in a different working environment.

I can give you some pointers though:
- Don't use regex unless necessary. I find that a lot of people use it for very simple tasks that could do with i.e. str_replace().
- Make sure you do skill yourself provoundly in regex though, since they're vital for more complicated string manipulation
- Don't get stuck on an idea, if you can't solve a problem with the string functions you're using, distance yourself from the it for a while and think of other methods to solve the problem (but that goes for all programming problems I guess :) This might sound like advice that everyone knows already, but I had to learn it...

Good luck,
TeRReF
0
 
LVL 7

Author Comment

by:weikelbob
ID: 18052371
TeRReF,

Thank you. That synopsis is exactly what I was looking for.

Now what is optimization of code?  (Let me know if I should open a separate question.)

0
 
LVL 29

Expert Comment

by:TeRReF
ID: 18052404
Well, there's always good and bad approaches to problems. Ones that take a lot of time and or resources and ones that don't.
I realize that sometimes it's more work to do things the 'right' way, especially when under time pressure. But ALWAYS keep opmimization in the back of your head when developping.
To give you some examples:
Using file_get_contents() instead of fopen(), fread()/fgets() and fclose() is easier. It will be a good method if the file is small, but when you work with huge files it means that the whole file has to be loaded into memory. When you use fopen(), etc. this will not happen and you will be able to handle the file 1 line at a time...

Another example is DB result sets. Same story, a lot of people and the whole resultset to an array first and then start to process it. A better way (usually) is to retrieve the resultset 1 row at a time and process it in the same loop...

These are just pointers and you will have to analyze every situation on it's own since they're all different. Saying these sorts of things during the interview, will help you a lot though. It will make them realize you are aware.

So, during the interview it's not all about knowledge about the language aspects, equally important is how you use it...
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 18052410
Oh, another important part of optimization is query performance.
0
 
LVL 7

Author Comment

by:weikelbob
ID: 18052530
"IF they're using PHP5 especially, OOP"

What are you referring to here?
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 18052643
In PHP5, Object Oriented Programming capabilities matured (more or less). In other words, since then it's possible to do some serious OOP programming in PHP. As soon as it was available, I started to use it since it makes reusability of code easier.
0
 
LVL 7

Author Comment

by:weikelbob
ID: 18052649
OK.

So how do you create a class in PHP5?  (Only a brief answer is needed)
0
 
LVL 12

Assisted Solution

by:AmigoJack
AmigoJack earned 100 total points
ID: 18053209
please... that last question doesnt make you sound so intermediate.
http://www.php.net/manual/en/language.oop5.php
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 18053920
<?php

        class blah {
                public $member;
                //other members (vars)

                function __construct($var) {
                      $this->member = $var
                }

                 // other methods that define the class' functionality
        }

         $object = new blah('value');

?>
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 8

Expert Comment

by:jk2001
ID: 18057339
I suggest that you don't even bother trying to fool the interviewer.  Just fess up to how much PHP you know.  If you know Java well, it won't be a big issue -- they'll probably assume you can be taught.
0
 
LVL 7

Author Comment

by:weikelbob
ID: 18058144
You're right jk2001,

I don't want to fool them.

I'm seeing that there is a lot of PHP I don't know.

Perhaps to finish this off, you guys could give me some links to advanced tutorials.

Bob

0
 
LVL 8

Expert Comment

by:jk2001
ID: 18058158
I learned a lot of PHP by downloading canned scripts and reading the code.  A lot of it wasn't that good, though.  Managing a codebase for some project is a great way to get good, very fast.  If you know someone who needs a CMS-backed website, maybe you can volunteer to install and configure the system, and add a few features.

The PHP.net site has a lot of good examples, too.  Look at the comments.
0
 
LVL 7

Author Comment

by:weikelbob
ID: 18058164
"I learned a lot of PHP by downloading canned scripts and reading the code. "

Good idea. Do you have some direction or links as to where to come across the right scripts?

0
 
LVL 8

Expert Comment

by:jk2001
ID: 18058701
Here are the ones I've studied, with a few star ranks indicating code quality/interesting-ness:

HORDE/IMP **** (out of 5)
Drupal ***
PhpMyAdmin ****
PHPMailer **

That's the open source stuff.  I've also used HiveMail, vBulletin, aeDating, GUSTMail.  They vary in quality, too.  I usually look for stuff at hotscripts.com and freshmeat.net.  Also, there is a lot of code at PHPClasses.com, php.net, and in the PEAR repository.

Most established scripts are written for PHP4, while most of the new frameworks rely on PHP5.
0
 
LVL 12

Expert Comment

by:AmigoJack
ID: 18061034
sidenote: thx jk2001 for hotscripts.com - from that i found a wonderful WYSIWYG editor for free which works on MSIE, OPER and FIRE :) thx alot
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 18061089
@AmigoJack
Can you share the URL for that editor with us? :)
0
 
LVL 12

Expert Comment

by:AmigoJack
ID: 18062799
@TeRReF: http://www.openwebware.com/products/openwysiwyg/
its a very good enhancement (i.e.) for a html-allowed phpBB. users without knowledge of html can nearly work with it like they know it from ms word - and skilled users can always toggle between html- and text-view. of course, this one is also not a perfect one, but the best solution ive seen so far (which also cares for all major browsers)
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 18062808
@AmigoJack
Thanks! Looks very good.
0
 
LVL 7

Author Comment

by:weikelbob
ID: 18071856
jk2001,

Can you give me a link to specific pieces of, for example, HORDE/IMP code? it's a big project and I'm not sure where to start.

0
 
LVL 8

Expert Comment

by:jk2001
ID: 18072389
Yes, all those are big projects.   Here's the URL for horde.

http://www.horde.org/imp/

For smaller scripts, I suggest hotscripts.  Some of those require payment to deploy, but you can still look at the code to learn things.
0
 
LVL 16

Accepted Solution

by:
ellandrd earned 100 total points
ID: 18087833
to learn OO PHP, check this site out:

http://phpbee.com/examples/object_oriented_php/

hope this helps and good luck with the job!

ellandrd
0
 
LVL 7

Author Comment

by:weikelbob
ID: 18088150
ellandrd,

Thanks! I just spent 5 minutes in that link and I've already learned a lot.

Question: When do you use OO PHP in a project?
0
 
LVL 16

Expert Comment

by:ellandrd
ID: 18091455
yes its a good site isnt it.  i first came across this site a few months ago while searching for a PHP script and i noticed your question in the list of open questions and thought - i know the perfect PHP website...  im glad its helping you learn more and prepare better for interview!

>>When do you use OO PHP in a project?

Very good question Bob! Well I suppose the whole point of OOP is to think in terms of objects - real things.  This
means nouns which have a state/data and verbs which cause them to perform actions.

GUI programming is one place where OO is handy and obvious.  Having a
Window class which draws itself makes alot sense.  A list of windows which your
program owns is then quite simple.

Here are 2 nice discussions related to OOP that will help you understand more:

When to use and when not to use OOP
(http://www.sitepoint.com/forums/showthread.php?t=182925&page=1)

Maximize PHP apps using OOP techniques
(http://builder.com.com/5100-6371-5054846.html)

Good Luck
Ellandrd
0
 
LVL 7

Author Comment

by:weikelbob
ID: 18198726
Thanks everyone,

Bob
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now