Jump to content

marcus

Members
  • Posts

    1,842
  • Joined

  • Last visited

Posts posted by marcus

  1. What Michan said will work which will convert " to " and < to < etc...

     

    If you just want to remove like bold, italic and other forms of HTML use strip_tags()

     

    for your BBCode you would have to use a form of preg replace or str replace

     

    for bold it would be something like

     

    $find = "/\[b\](.*?)\[\/b\]/is";
    $replace = "<b>$1</b>";
    
    $bold_test = "hello my name is [b]marcus[/b]";
    echo preg_replace($find, $replace, $bold_test);
    

  2. that's a lot of usage of the modulus.

     

    <?php
    
    echo "<table border=\"1\" cellspacing=\"3\" cellpadding=\"3\">";
    
    $array = array("once", "there", "was", "a", "puppy", "who", "loved", "friendly", "people");
    
    
    echo "<tr>\n";
    
    $z = round(count($array)/3);
    
    $x=1;
    $y=1;
    for($i=0;$i<count($array);$i++){
    echo "<td>".$array[$i]."</td>\n";
    
    if($x == 3){
    	echo "</tr>\n";
    
    	if($y != $z){
    		echo "<tr>\n";
    	}
    
    	$x=0;
    	$y++;
    }
    
    $x++;
    }
    
    
    echo "</table>";
    
    ?>
    

     

    i'd say something like that is a bit simpler

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