Jump to content
php.lv forumi

Neizlasa vajadzīgos simbolus ārā


waplet

Recommended Posts

$textcontent = minus($row[0]);// šeit vajadzētu izlasīt visiem simboliem
$textcontent = saisinat($textcontent,100);// ja garāks par 100.. saīsina un pieliek trīspunkti

funkcijas

 

function saisinat($teksts,$lenght)
{
$garums = strlen($teksts);
$teksts = substr($teksts, -$garums, $lenght);
if($garums > $lenght){
$teksts = $teksts."...";
}
return $teksts;
}
function minus($teksts){
$minus = array("'", "-", "*",);
$teksts = str_replace($minus, "",$teksts);
return htmlspecialchars($teksts);
}

Nesaprotu kāpēc viņš neizlasa tos mīnusus ārā.

Vai ir kāds savādāks paņēmietns lai izasīju ārā?

Link to comment
Share on other sites

hz, darbojas.

function minus($teksts){
$minus = array("'", "-", "*",);
$teksts = str_replace($minus, "",$teksts);
return htmlspecialchars($teksts);
}

$x = "šeit' '-' **** vajadzētu";
echo $textcontent = minus($x);// šeit   vajadzētu

 

11. rindiņā, kas tas par komatu masīva beigās?

Having a trailing comma after the last defined array entry, while unusual, is a valid syntax.

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...