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
https://forums.phpfreaks.com/topic/16312-text/#findComment-67743
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
https://forums.phpfreaks.com/topic/16312-text/#findComment-67751
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.