Search found 11 matches

by tomcatf14
Mon Sep 17, 2007 6:18 pm
Forum: PHP - Code
Topic: Strip off "%" from a string
Replies: 6
Views: 563

Putting int() solved the problem. Initially, i thought the syntax should be int($score1). Thanks. Let me clarify on the first sentence $dfsplitdata[4] = it may contain string such as (abcde) or number only (after stripped off the %). Previous, before declaring $score1 as integer, (abcde) met the con...
by tomcatf14
Mon Sep 17, 2007 5:58 pm
Forum: PHP - Code
Topic: Strip off "%" from a string
Replies: 6
Views: 563

feyd | Please use , and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color] I have a ...
by tomcatf14
Mon Sep 17, 2007 4:18 pm
Forum: PHP - Code
Topic: Strip off "%" from a string
Replies: 6
Views: 563

Strip off "%" from a string

Code: Select all

$variable1 = 100%
How do i strip off the % from the variable so that i can get the integer only?
by tomcatf14
Tue Sep 11, 2007 12:28 pm
Forum: PHP - Code
Topic: Error: PHP exec mysql stop
Replies: 5
Views: 450

Any sample code? I'm noob in PHP...just started PHP 2 weeks back
by tomcatf14
Tue Sep 11, 2007 12:21 pm
Forum: PHP - Code
Topic: Error: PHP exec mysql stop
Replies: 5
Views: 450

I have created a script own by root with permission 777 to run mysql restart but still not able to solve the problem.
by tomcatf14
Tue Sep 11, 2007 7:29 am
Forum: PHP - Code
Topic: Error: PHP exec mysql stop
Replies: 5
Views: 450

Error: PHP exec mysql stop

My script look as below:- <?php $output = shell_exec('/usr/local/etc/rc.d/mysql-server stop'); echo "<pre>$output</pre>"; ?> The result: mysql not running? (check /var/db/mysql/v3b.dnsvine.com.pid). If i run "/usr/local/etc/rc.d/mysql-server stop" on the server, mysql could be st...
by tomcatf14
Thu Sep 06, 2007 6:27 am
Forum: Regex
Topic: [solved]preg_split more than 1 type delimiters
Replies: 3
Views: 1195

I used the other way. str_replace to replace the ":" with "." and run the preg_split as usual.
by tomcatf14
Thu Sep 06, 2007 6:02 am
Forum: Regex
Topic: [solved]preg_split more than 1 type delimiters
Replies: 3
Views: 1195

[solved]preg_split more than 1 type delimiters

Code: Select all

$splitdata = preg_split ("/,/","/:/" $lineVar1);
How do i tell preg_split to split the data is a string if there is more than one type of delimiters?Letz say a "." and ":" at the same string.

------------------------
How, are, you, today: Bob
by tomcatf14
Thu Sep 06, 2007 6:00 am
Forum: PHP - Code
Topic: Splitting strings in file to array
Replies: 3
Views: 477

Problem solved by using line count and loop array.
by tomcatf14
Thu Sep 06, 2007 1:05 am
Forum: PHP - Code
Topic: Splitting strings in file to array
Replies: 3
Views: 477

Everah wrote:file() and explode() might help.
How i do use explode for non consistent white space across the file? Letz say like this:-

----------------------
Filesystem 1K-blocks Used Avail Capacity Mounted on
by tomcatf14
Wed Sep 05, 2007 3:38 pm
Forum: PHP - Code
Topic: Splitting strings in file to array
Replies: 3
Views: 477

Splitting strings in file to array

Hi, I would like to split each strings to an array on a multiple lines file. The file should look like as below:- ------------------------------ Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/ad0s2a 507630 190196 276824 41% / devfs 1 1 0 100% /dev /dev/ad0s2e 507630 20 467000 0% /tmp /dev/...