Need help understanding PHP test instructions

At the current moment i am trying to land a software development apprenticeship and i have been given a test to complete however i am having a bit of difficulty understanding some of the instructions/ what to do.

Inside index.php create a PHP array containing all the cities in Italy. Loop through this array and under the"< h1>< /h1 >" tag into the following " < div class="col-xs-12 col-md-6 col-md-push-3" > < /div > " tag generate a list of all the cities starting with the letter G, B and I grouped in columns. Each column should have a header that represents the letter and underneath a body containing the list of the cities for that specific letter.

i need to hand this test in by friday. this is my one chance to acc sort my shit out and get my future together.

If you cannot write something so simple, you do not deserve that apprenticeship.

ahh wow thanks that was so helpful. dick

im just confused on the wording in the instructions. im doing a course to learn php online.

What part of the text don't you understand?

the parts where it says loop though the array ( i kinda get that ) and under the"< h1>< /h1 >" tag into the following " < div class="col-xs-12 col-md-6 col-md-push-3" > < /div > " tag (this i dont get).

The part "col-xs-12 col-md-6 col-md-push-3" looks like a Bootstrap predefined css:
- xs means extra small devices (phones)
- md means medium devices (desktop)
- md-push is referring to changing the ordering of the columns
It's about responsive design.

so would this bootstrap code go into the < head > like the rest of the meta bootstrap code or somewhere else ?

It means that for each letter, G, B and I you'll have three h1 groups (headings). Depending on the size of the browser window, the CSS will cause some of the things to auto-resize.

ahhhh i see that makes alot of sense now thanks.

1 Like

No, Bootstrap is like a collection of CSS classes that are already written for you. You just use them like any regular classes. The HTML code you need to generate from PHP will go somewhere inside the "body" section of your code.

You really need to understand what the Bootstrap classes do. Check this out:

After that the PHP will come naturally.

In case you didn't know yet, Bootstrap needs to be installed. Or at least referenced. Instructions here:

Anyway, good luck :)

yeah ive already gotten past all the installation stuff. was just a bit stuck thanks.

Have you completed your task yet and what company you looking to get into ?

i have not yet finished, i cant really figure out how to get the contents from my array grouped into each column.

The company im applying for is Aalto invest. its an investment company creating a team of apprentices and senor software developer to create a web application.

got hand it in in about 21 hours and still got a bunch of jquery stuff to go through.

send me a picture of what you have done so far and then i will be able to assist you and yeah i heard of that company where is it based ?

thats what ive got so far.

i think the company has 3 offices. one in central london one in switzerland and one in charlotte NC.

You have some html syntax errors. And you need to be more efficient with your code. Also you need to make your code more manageable so that it can be modified quickly.

For example the letters that you're looking for can be made into another array. If they ask you to modify the code to include another letter, or remove one, you just quickly modify the letters' array. Or you can make a function that takes the letter as an argument. Or you can combine the two ideas into one.

I don't see the reason here, but you should always think about writing in object oriented style or procedural style.

Before you start writing the complete code, you can try a few steps:

  1. write just the HTML code, in a 100% valid manner, with some dummy data and make sure the browser displays the data in the way that the test requires
  2. identify segments of code that are repeating inside the HTML code (some segments of code are static, the repeating ones will probably be dynamic)
  3. think about defining a function that you need to write once but can be called multiple times to generate those repeating HTML segments
  4. now that you have a very good idea about what you need to have in your page, write the necessary PHP code and replace the HTML that needs to be generated (the dynamic content)

We could give you the code but that won't help you at all. You need to come up with it by yourself, or you're not going to become a web developer.

how far have you gotten now ?