I have written the below script to determine whether a string is palindrome or not ?
But its not working, any help to debug it ?
I am new to this forum but when I searched for my question, I found that many people refused to answer this question thinking that its Homework question, Therefore I... (2 Replies)
Hi,
I want to know that if there are any methods, which check the MQ, is up or down. Actually I have to write one job which checks the status of any one MQ is up or down.
I don't know if there is any method of MQ, which tells the MQ, is up.
Could u please give some link for the study... (1 Reply)
could you please find a solution for this
script that checks if any of a list of users given on the command line is logged in. For each user the script should say whether this user is logged in or not. The script prints an error message if no parameter is given. And ask the user to enter a name... (3 Replies)
I am trying to write a script to get all the html files under a source directory and and for each html file, run a program with html file as an argument. This program generates an output which I need to save as htmlfilename.txt ( right now i was trying to print it on the command line)
... (11 Replies)
hi guys ..newbie here i would like to create a simple script tat will detect wether the machine has IP or not ...
but it seems that my script doesnt really work it kept rebooting...
i set this script during boot so that it will check else it will reboot
it a shell script thou...
... (5 Replies)
Help plz
Does any one have any idea how to compare interval ranges of 2 files.
finding 1-4 (1,2,3,4) of input2 in input1 of same key "a" values (5-10, 30-40, 45-60, 80-90, 100-120 ). Obviously 1-4 is not one of the range with in input1 a. so it should give out of range.
finding 30-33(31,32,33)... (1 Reply)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
When you type a command, the shell checks several places to see if it can find a command with that name to run. ... (5 Replies)
Hi,
I put this at start of my shell (korn shell) to be sure that the shell is not already running and sometimes it fails and says that it is already running which is not true !
sleep 1
/usr/bin/ps -ef | /usr/bin/grep "$0" | /usr/bin/egrep -v grep>$LOGDIR/$0.res
isup=$(cat $LOGDIR/$0.res|wc... (4 Replies)
for example I have
make target
file is optional. So can I check whether there is or no? I tried
if test $# -eq 1
then
path=$1
else path=$2
fi
But it doesnt work properlu ;(
Please use code tags next time for your code and data. (12 Replies)
I been having a lot of trouble trying to start up a 3rd party application in Solaris 7 but it seams that its missing entry's when trying to run the files so maybe the start shells scripts have errors and maybe thatr is what is causing the issues I have added two links to the shells can anyone check... (5 Replies)
Discussion started by: Wpgn
5 Replies
LEARN ABOUT PHP
explode
EXPLODE(3) 1 EXPLODE(3)explode - Split a string by stringSYNOPSIS
array explode (string $delimiter, string $string, [int $limit])
DESCRIPTION
Returns an array of strings, each of which is a substring of $string formed by splitting it on boundaries formed by the string $delimiter.
PARAMETERS
o $delimiter
- The boundary string.
o $string
- The input string.
o $limit
- If $limit is set and positive, the returned array will contain a maximum of $limit elements with the last element containing the
rest of $string. If the $limit parameter is negative, all components except the last -$limit are returned. If the $limit parame-
ter is zero, then this is treated as 1.
Note
Although implode(3) can, for historical reasons, accept its parameters in either order, explode(3) cannot. You must ensure that the
$delimiter argument comes before the $string argument.
RETURN VALUES
Returns an array of strings created by splitting the $string parameter on boundaries formed by the $delimiter.
If $delimiter is an empty string (""), explode(3) will return FALSE. If $delimiter contains a value that is not contained in $string and a
negative $limit is used, then an empty array will be returned, otherwise an array containing $string will be returned.
CHANGELOG
+--------+-----------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+-----------------------------------------+
| 5.1.0 | |
| | |
| | Support for negative $limits was added |
| | |
+--------+-----------------------------------------+
EXAMPLES
Example #1
explode(3) examples
<?php
// Example 1
$pizza = "piece1 piece2 piece3 piece4 piece5 piece6";
$pieces = explode(" ", $pizza);
echo $pieces[0]; // piece1
echo $pieces[1]; // piece2
// Example 2
$data = "foo:*:1023:1000::/home/foo:/bin/sh";
list($user, $pass, $uid, $gid, $gecos, $home, $shell) = explode(":", $data);
echo $user; // foo
echo $pass; // *
?>
Example #2
explode(3) return examples
<?php
/*
A string that doesn't contain the delimiter will simply
return a one-length array of the original string.
*/
$input1 = "hello";
$input2 = "hello,there";
var_dump( explode( ',', $input1 ) );
var_dump( explode( ',', $input2 ) );
?>
The above example will output:
array(1)
(
[0] => string(5) "hello"
)
array(2)
(
[0] => string(5) "hello"
[1] => string(5) "there"
)
Example #3
$limit parameter examples
<?php
$str = 'one|two|three|four';
// positive limit
print_r(explode('|', $str, 2));
// negative limit (since PHP 5.1)
print_r(explode('|', $str, -1));
?>
The above example will output:
Array
(
[0] => one
[1] => two|three|four
)
Array
(
[0] => one
[1] => two
[2] => three
)
NOTES
Note
This function is binary-safe.
SEE ALSO preg_split(3), str_split(3), mb_split(3), str_word_count(3), strtok(3), implode(3).
PHP Documentation Group EXPLODE(3)