Jump to content
php.lv forumi

Vēstuļu sūtīšana


Pentiums

Recommended Posts

Gribu pie vēstuļu sūtīšanas temata pievienot kautko līdzīgu kā draugiem.lv un citos portālos, ja tematu nenomaina, tad temata priekšā parādās [RE:1]blablabla, [RE:2]blablabla, [RE:3]blablabla ,[RE:4]blablabla... kā īsti ir, būs ar explode jāstrādā? Varat parādīt kādu piemēru?

Link to comment
Share on other sites

$str = '[RE:1]Čau kā iet?';
$str = explode('[RE:', $str);
$str = explode(']', $str[1]);
echo $str[0];

 

Kautkā tā?

Edited by Pentiums
Link to comment
Share on other sites

if(strstr($data['virsraksts'], '[RE:')) {
$str = $data['virsraksts'];
$str2 = explode(']', $str);
$str = explode('[RE:', $str);
$str = explode(']', $str[1]);
$str = $str[0];
$str++;
$data['virsraksts'] = '[RE:'.$str.']'.$str2[1];
}
else {
$data['virsraksts'] = '[RE:1]'.$data['virsraksts'];
}

 

Man šitāds. Pamēģināšu tavu :)

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