PHP question stuck

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Fri May 03, 2013 4:52 pm

PHP question stuck

Postby souled » Fri May 03, 2013 4:57 pm

Good day fellow programmers.

I'm stuck in this question for days.
From my code below, I have to traverse the array and show the output, however, I have to break it to the next line everytime I hit the $multiple(which is the row&column limit according to the number of words i type)

My output is always the values in a straight line, or they will space out first then place my values at the bottom of the page.

<h1>Here are the exploded words</h1>
<table border="1">
$words = $_POST["words"];
$wordsArray = explode(",",$words);

$r = $count;
$c = sqrt($r);
$multiple = ceil($c);



Please help!

New php-forum User
New php-forum User
Posts: 20
Joined: Tue Mar 06, 2012 11:05 pm

Re: PHP question stuck

Postby swarups » Sun May 12, 2013 10:27 pm


To have a break after each word, you have two option as described below:

1. Add a '<br />' after the word. like print"<td>$wordsArray[$a]<br /></td>";
2. Display each word in a single row. Like print"<tr><td>$wordsArray[$a]<br /></td></tr>";

Swarup sahu

Return to “PHP coding => General”

Who is online

Users browsing this forum: Bing [Bot] and 9 guests