help me to set a code

Started on the old forum in March 2012 · view the original in the archive · old links redirect here

1 reply · 277 views · started 14 years ago · 1 min read

2 participants
Lue_chin Developer · 107 posts #1

hello friends i have a idea and want a code for this can we paste the first 15 character of a story means i have a full story or description about something

For ex : if a description nokia 5233 is the mobile which have more powerful fictions and i want to paste like this Nokia 5233 is the mobile.....

can we do this with php

something else Fellow · 2,296 posts #2

taken from php.net

<?php
$rest = substr("abcdef", 0, -1);  // returns "abcde"
$rest = substr("abcdef", 2, -1);  // returns "cde"
$rest = substr("abcdef", 4, -4);  // returns false
$rest = substr("abcdef", -3, -1); // returns "de"
?>

Just realized i copyied the above code with negative last numbers .... they can be positive also (counting from begining of string) so in your case you would need

$rest = substr($rest, 0, 15);  // returns first 15 chars

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close