Jump to content

Text


Woodburn2006

Recommended Posts

My suggestion is just to split the variable into 2 parts using the length.
Calculate the middle of the string, do a strpos to find the 1st blank and calculate the length of the first part and the second part.

Do a [code]<tr><td>$first_part</td<td>$second_part</td></tr>[/code] at you are done.

Ronald  ;D
Link to comment
Share on other sites

Just a sample (the table border set to 1 so you can see it is actually split):
[code]
<?php
$string = "This is a text stringandisnow to be split in 2 parts";
$length = strlen($string)/2;
$start=strpos(substr($string,$length),' ');
echo '<table border="1">';
echo '<tr><td>'.substr($string,0,$length+$start).'</td><td>'.substr($string,$length+$start).'</td></tr>';
echo '</table>';
?>[/code]

Ronald  ;D
Link to comment
Share on other sites

[code]<?php
$string = "This is a text stringandisnow to be split in 2 parts";
$length = strlen($string)/2;
$start=strpos(substr($string,$length),' ');

$part1 = substr($string,0,$length+$start);
$part2 = substr($string,$length+$start);
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.