Jump to content
php.lv forumi

Formatējam Vārdu


Morphius

Recommended Posts

Ar dažu labu funkciju no teksta tiek izvilkts simbolu sakopojums...kjkjteksts.5te

Netieku skaidrs kā lai izvelk vārdu "teksts", respektīvi jāatņem no abām pusēm 4 simboli...pie nosacījuma ka šie simboli mainās...

Sanāk tā ka šī rinda jāsadala pa burtiem un tad kaut kā mistiski jāatņem tie burti?! Idejas?

Edited by Morphius
Link to comment
Share on other sites

var arī vienkāršāk ;)

 

piemēri bez/ar utf-8

echo substr('1234bāblāblā1234', 4, -4) . '<br />';  // blāblāblā
echo mb_substr('ššššbāblāblāčččč', 4, -4, 'utf-8') . '<br />';  // blāblāblā

Edited by 2easy
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...