Posts
 
Reputation
Joined
Last Seen
Ranked #432
Strength to Increase Rep
+7
Strength to Decrease Rep
-1
89% Quality Score
Upvotes Received
29
Posts with Upvotes
24
Upvoting Members
21
Downvotes Received
3
Posts with Downvotes
3
Downvoting Members
3
12 Commented Posts
2 Endorsements
Ranked #621
Ranked #505
~67.6K People Reached
Favorite Forums
Favorite Tags
Member Avatar for Shantanu88d

I think this would work reasonably fast: [CODE]<?php $filename = "/path/to/file.txt"; $handle = fopen($filename,"r"); if ($handle === false) { exit; } $word = ""; while (false !== ($letter = fgetc($handle))) { if ($letter == ' ') { $results[$word]++; $word = ""; } else { $word .= $letter; } } fclose($handle); …

Member Avatar for edwinhermann
0
567
Member Avatar for branding4you
Member Avatar for ab_omid
0
5K
Member Avatar for stephen_UK

My approach would be to create not so much as a database but just a flat file, say tab delimited. You can read the entire thing into memory with PHP and manipulate the data as needed. You could either run a web server locally (Macs have this already built in) …

Member Avatar for stephen_UK
0
167
Member Avatar for statsProf

The dots get changed to underscores. So use this instead: $linex = $_GET['shapes_image_x']; $liney = $_GET['shapes_image_y'];

Member Avatar for statsProf
0
192
Member Avatar for adityamadhira

The Content-Type header must be sent before the Content-Disposition header.

Member Avatar for adityamadhira
0
139
Member Avatar for garyjuano

Neither of these are the correct approach. strtotime turns the date into an integer. You then subtract one integer from the other which gives you a difference. You are then trying to turn that difference into a date (which will result in a date close to the epoch depending in …

Member Avatar for edwinhermann
0
137
Member Avatar for petrovitch

Of course. Usually it's in /usr/bin/php Use this syntax: [CODE]/usr/bin/php[I] filename.php[/I][/CODE]

Member Avatar for edwinhermann
0
156
Member Avatar for Commando112

Use the $_SESSION array instead. So, for example: [CODE]$_SESSION["name"]="foobar";[/CODE] So now you should not use session_register(), session_unregister() or session_is_registered(). Can you can test using: [CODE]if (isset($_SESSION["name"])) { ... }[/CODE]

Member Avatar for edwinhermann
0
101
Member Avatar for unikorndesigns

PHPShadow: [URL="http://www.phpshadow.com"]http://www.phpshadow.com[/URL] This is probably the most cost effective solution because you only need to buy a licence (5 euro) when you encrypt your source code. Once encrypted, your source code will work forever and you don't have to pay them another penny.

Member Avatar for edwinhermann
0
929
Member Avatar for kirtan_thakkar

[CODE]<?php function find_value($input) { // $input is the word being supplied by the user $handle = @fopen("/users/edwin/list.txt", "r"); if ($handle) { while (!feof($handle)) { $entry_array = explode(":",fgets($handle)); if ($entry_array[0] == $input) { return $entry_array[1]; } } fclose($handle); } return NULL; } ?>[/CODE]

Member Avatar for trickist17
0
12K
Member Avatar for bangla

You're only opening the file. You're not outputting it. Try changing [CODE]$file=fopen("welcome.txt","r");[/CODE] to [CODE]readfile("welcome.txt");[/CODE]

Member Avatar for ddymacek
0
161
Member Avatar for ibrahimbit17

PHPshadow ([url]http://www.phpshadow.com[/url]) encrypts PHP code, and requires a license code (a file) to be copied onto the server before it will work. One option is a 50 Euro one-off payment per customer (it's locked to a specific domain name). The other option is an annual payment of 20 Euro. Because …

Member Avatar for ibrahimbit17
0
352
Member Avatar for puvi

I presume you're using PuTTY to initiate an SSH connection. If so, try the editors [B]nano[/B] or [B]pico[/B] e.g. nano index.php

Member Avatar for edwinhermann
0
76
Member Avatar for knan

Are you sure you have the [URL="http://www.php.net/manual/en/book.sockets.php"]sockets module[/URL] installed in your PHP installation? Check by looking at the output of phpinfo()

Member Avatar for edwinhermann
0
284
Member Avatar for karthik_ppts

Just elaborating on twiss's post: [CODE=HTML]<script type="text/javascript"> function doSomething(elem) { alert ('The ID of the element which triggered this is: ' + elem.id; } </script> <div id="blah" onClick="doSomething(this)">Blah blah blah</div>[/CODE]

Member Avatar for ushajase
0
16K
Member Avatar for phorce
Member Avatar for decade

[QUOTE=tnjiric;1607096][CODE]echo substr($search,0,4); //this would print out "Hello"[/CODE][/QUOTE] Not quite. That would print out "Hell" (4 characters)

Member Avatar for tnjiric
0
136
Member Avatar for Paaat

I agree with evstevemd. [CODE]foreach ($array as $key => $value) { echo 'The key is '.$key.' and the value is '.$value; }[/CODE] $key and $value are created as part of the foreach statement.

Member Avatar for edwinhermann
0
115
Member Avatar for palsoft

You can use cron to call a php page. IN your crontab file, the command part would be something like this: [CODE=shell]/usr/bin/php /users/me/www/myfile.php[/CODE]

Member Avatar for palsoft
0
2K
Member Avatar for Shantanu88d

[QUOTE=Shantanu88d;1588131]ok but, in case when we have an entire text file containing thousands of words, what approach can we take ?[/QUOTE] See here: [url]http://www.daniweb.com/web-development/php/threads/369522[/url]

Member Avatar for edwinhermann
0
3K
Member Avatar for haimz

[CODE]<?php $text = "one\ntwo\nthree\nfour"; echo preg_replace("/\\n/m"," \n",$text); ?> [/CODE]

Member Avatar for edwinhermann
0
97
Member Avatar for paarade

This page does the calculation. It uses DateInterval so requires PHP 5.3.0 or later. [CODE]<?php $age = $_GET["age"]; $year = $_GET["year"]; $month = $_GET["month"]; $day = $_GET["day"]; if (!$_GET["age"]) { } elseif (!checkdate($month,$day,$year)) { echo "Invalid Date"; } else { $one_year = new DateInterval("P1Y"); $one_day = new DateInterval("P1D"); $age_years = …

Member Avatar for diafol
0
133
Member Avatar for public-image

Here I'm assuming you will be executing the code as the user logs in. So you can do this: [CODE]$random_hour = randbetween(0,23); $current_hour = date("G",time()); if ($current_hour == $random_hour) { // something great happens }[/CODE] If you're trying to implement it on a weekly cycle (i.e. choosing a random hour …

Member Avatar for edwinhermann
0
8K
Member Avatar for jacob21

It's easier to troubleshoot if you arrange your code neatly, like this:[CODE=php]<?php if (empty($mobile)) { echo '<script language="javascript">alert("Enter Phone Number")</script>;'; } elseif (!(empty($mobile))) { if ((is_numeric($mobile))) { if ((strlen($mobile)!=10)) echo '<script language="javascript">alert("phone number should be of 10 digit")</script>;'; } else { echo '<script language="javascript">alert("Please Enter valid phone number")</script>;'; } } …

Member Avatar for edwinhermann
0
83
Member Avatar for Spyzker

Look at line 21 of your code:[CODE]echo '</div>' [/CODE] You are missing the semi-colon at the end of the line, i.e. like this:[CODE]echo '</div>;' [/CODE]

Member Avatar for diafol
0
174
Member Avatar for rpv_sen

You cannot have multiple tags with the same id. Your code will output multiple instances of <input id="rate"> and <input id="qty">. You should serialise them, like this: [CODE]<?php include("config.php"); ?> <script type=text/javascript> function multiply(id){ var a; var b; var c; a = document.getElementById("rate" + id).value; b = document.getElementById("qty" + id).value; …

Member Avatar for edwinhermann
0
191
Member Avatar for verbob

This code does what you've asked, and starts looking from "tomorrow". [CODE]<?php $dt = new DateTime("tomorrow",new DateTimeZone("Pacific/Auckland")); $di = new DateInterval("P1D"); while ( ($dt -> format("l") != 'Tuesday') && ($dt -> format("l") != 'Saturday') ) { $dt -> add($di); } echo 'Next sale: '.$dt->format("l, j F Y"); ?>[/CODE] Just replace …

Member Avatar for verbob
0
146
Member Avatar for Yemen Coder

AlmostBob's URL to the PHP site is fine, but his description is a bit off. Slashes and spaces are fine. It's nothing to do with the character set but in fact to do with characters reserved for HTML code. Imagine, for example that PHP_SELF contained a greater-than symbol like this: …

Member Avatar for Yemen Coder
0
146
Member Avatar for kained

Is your site one that people have to "sign in" to? If so, why not just build the consent into the standard terms and conditions that one must agree to in order to create an account? If it's a public site and does not require users to sign in, it's …

Member Avatar for edwinhermann
0
208
Member Avatar for noahshoa2

If I can just chime in here.... Might just want to add a space after [B]Location:[/B]

Member Avatar for twiss
0
209