Search found 757 matches

by hyper
Tue Dec 11, 2018 5:41 pm
Forum: PHP coding => General
Topic: Placeholder characters in template that will not break code
Replies: 3
Views: 36

Re: Placeholder characters in template that will not break code

++ has the potential to cause problems as it is the increment operator.

Code: Select all

for ($i=0; $i<10; $i++){
  ...
}
by hyper
Tue Dec 11, 2018 5:35 pm
Forum: PHP coding => General
Topic: Rolling 6 different dice...
Replies: 3
Views: 17

Re: Rolling 6 different dice...

?

Code: Select all

if ($dice1 == $dice2){
  ...
}
by hyper
Mon Dec 10, 2018 9:15 am
Forum: PHP coding => General
Topic: Placeholder characters in template that will not break code
Replies: 3
Views: 36

Re: Placeholder characters in template that will not break code

You code as it stands will output: <!DOCTYPE html> <html> <body> Roses are !!roses!! </body> </html> Are you then going to parse the buffer? As to "best"?, what you have suggested is probably as good as anything else if that's the way you want to go, it's down to each application. Whether it's as go...
by hyper
Mon Dec 10, 2018 9:01 am
Forum: PHP General
Topic: What change does array_unique() make when migrating to PHP 7.2?
Replies: 10
Views: 177

Re: What change does array_unique() make when migrating to PHP 7.2?

Sorry, I wasn't clear enough; the result I got was: array(5) { [0]=> string(5) "apple" [1]=> string(6) "banana" [2]=> string(5) "grape" [4]=> string(4) "Kiwi" } And it was on my own development PC running V7.2.10. As hard as the developers try, it sometimes happens that certain bits don't work compl...
by hyper
Fri Dec 07, 2018 7:03 am
Forum: PHP General
Topic: What change does array_unique() make when migrating to PHP 7.2?
Replies: 10
Views: 177

Re: What change does array_unique() make when migrating to PHP 7.2?

I think you don't understand my answer here. Let me make it clear again for you: You have run your tests and found no difference, my reading of the sentence is: <?php $array = ['apple', 'banana', 'grape', 'banana','Kiwi']; var_dump($array); var_dump(array_unique($array)); ($array); /* Output array(5...
by hyper
Thu Dec 06, 2018 11:45 am
Forum: PHP coding => General
Topic: PHP, server settings or other?
Replies: 3
Views: 65

Re: PHP, server settings or other?

I don't use it, have you tried a Joomla forum?

I'm sure that you are aware the version you are using reached its end of life 6 years ago?

Have you tried using the current version on a test machine?
by hyper
Wed Dec 05, 2018 3:57 pm
Forum: PHP coding => General
Topic: PHP, server settings or other?
Replies: 3
Views: 65

Re: PHP, server settings or other?

Have you contacted admin at your new provider? you might be able to revert to your older version while you sort out and update the differences. PHP v5.6 has many sub changes. You should really be looking to upgrade to v7 while you are fixing the problems. Your starting point will be the SQL or frame...
by hyper
Wed Dec 05, 2018 10:39 am
Forum: PHP General
Topic: What change does array_unique() make when migrating to PHP 7.2?
Replies: 10
Views: 177

Re: What change does array_unique() make when migrating to PHP 7.2?

I'm on the way to migrate the whole system of the product. Without describing your use and what migration means in this case, it is very difficult to give a helpful answer to your potential problem If you're that concerned, in my opinion, you'd be better off looking at another way of doing whatever...
by hyper
Tue Dec 04, 2018 12:56 pm
Forum: PHP General
Topic: What change does array_unique() make when migrating to PHP 7.2?
Replies: 10
Views: 177

Re: What change does array_unique() make when migrating to PHP 7.2?

Are you getting problems using the function since the change?
by hyper
Tue Dec 04, 2018 2:29 am
Forum: PHP General
Topic: What change does array_unique() make when migrating to PHP 7.2?
Replies: 10
Views: 177

Re: What change does array_unique() make when migrating to PHP 7.2?

The function name describes its function perfectly.

What you have quoted is a change that applies to PHP 7.2, it needs to be read in conjunction with the original description and not taken as a unique description of the function.
by hyper
Mon Nov 19, 2018 1:37 pm
Forum: PHP Scripts
Topic: Warning: preg_match(): Unknown modifier
Replies: 4
Views: 243

Re: Warning: preg_match(): Unknown modifier

Syntactically, that line is correct.

If this is for checking an email address, you might want to change it to:

Code: Select all

filter_var($email, FILTER_VALIDATE_EMAIL)
by hyper
Mon Nov 19, 2018 1:27 pm
Forum: PHP coding => General
Topic: php code embedded in wordpress site
Replies: 2
Views: 184

Re: php code embedded in wordpress site

I don't know anything about WordPress, but that looks like a dangerous piece of code to me, it gives a user the ability to upload a file and execute it doing whatever they want - unless the folder is in-accessible, no signing in, just put the address in your web browser and hijack. I would change th...
by hyper
Sun Nov 18, 2018 12:35 pm
Forum: PHP coding => General
Topic: Cube Randomizer
Replies: 18
Views: 488

Re: Cube Randomizer

An array is basically a list of variables using the same name, it's a construct of most languages; you'd normally learn about them once you have learned the basics of variables.

Keep up the good work!
by hyper
Sun Nov 18, 2018 12:30 pm
Forum: PHP Scripts
Topic: Warning: preg_match(): Unknown modifier
Replies: 4
Views: 243

Re: Warning: preg_match(): Unknown modifier

Are you sure

Code: Select all

if(preg_match("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $from)) {
is line 205?
by hyper
Sat Nov 17, 2018 3:04 am
Forum: PHP coding => General
Topic: Cube Randomizer
Replies: 18
Views: 488

Re: Cube Randomizer

You've done well making your own improvements, so points go to you :D I'm more than happy to help someone who helps themselves. If you are looking to learn more, there are several ways that you can compact your script; although this is only a short script, they can soon get out of control. I'm in no...
by hyper
Thu Nov 15, 2018 3:26 pm
Forum: PHP coding => General
Topic: Cube Randomizer
Replies: 18
Views: 488

Re: Cube Randomizer

Modify your php.ini file to display_errors = on Check this line very carefully: if($$sub_rotation == 1) you can see that it took that same side anyway If you expect something to be random, don't try to force it in a particular manner; if you are not happy in the way that you think it should be, the...
by hyper
Thu Nov 15, 2018 2:42 am
Forum: PHP coding => General
Topic: Cube Randomizer
Replies: 18
Views: 488

Re: Cube Randomizer

Modify your php.ini file to display_errors = on Check this line very carefully: if($$sub_rotation == 1) Also check your logic here: if ($sub_rotation == 1) { echo"L "; } if ($sub_rotation == 2) { echo"L2 "; } else { echo"'L "; } Follow it through and assume that $sub_rotation is 1, what is echoed?
by hyper
Wed Nov 14, 2018 11:08 am
Forum: PHP coding => General
Topic: Cube Randomizer
Replies: 18
Views: 488

Re: Cube Randomizer

You'll need to provide more information on what your problems are if the following does not solve it. Do you have error reporting set to display? In the mean time, compare these two lines: if($current == 1) if($rotation == 2) and then compare them to the rest of your if statements, having error repo...
by hyper
Tue Nov 13, 2018 12:00 pm
Forum: PHP coding => General
Topic: Cube Randomizer
Replies: 18
Views: 488

Re: Cube Randomizer

That's a good start, what I had in mind for the while loops is as follows: while ($previous == $current){ $current = rand(1,6); } Once you have found a new non-repeating number, store that for the next comparison; you can't use the same variable to store the new number and then check it against itse...
by hyper
Mon Nov 12, 2018 2:42 pm
Forum: PHP coding => General
Topic: Cube Randomizer
Replies: 18
Views: 488

Re: Cube Randomizer

You have already worked out the solution:
I want to make it so that the variable gets stored

Code: Select all

$rotation = rand(1,6);
now what you need is something to compare it to ... ?????

A while loop may serve you better than an if statement?
by hyper
Mon Nov 12, 2018 2:21 pm
Forum: mySQL & php coding
Topic: Master-Detail coding problem
Replies: 1
Views: 189

Re: Master-Detail coding problem

Compare the lines:

Code: Select all

$conn = new mysqli('localhost', 'USER', 'PW', '|DB');
and

Code: Select all

$result = mysqli_query($con, "SELECT * FROM audio WHERE id = $id");
by hyper
Sun Nov 11, 2018 12:23 pm
Forum: PHP General
Topic: Sum of hours
Replies: 3
Views: 265

Re: Sum of hours

What changes have you made to your code now that you have read about the differences between data types and how you can manipulate the different data types?
by hyper
Sun Nov 11, 2018 12:15 pm
Forum: PHP coding => General
Topic: Cube Randomizer
Replies: 18
Views: 488

Re: Cube Randomizer

A random number between 1 and 6 does mean that there is a possibility of the same number appearing twice?

Maybe rethink your strategy?
by hyper
Tue Nov 06, 2018 1:23 pm
Forum: PHP coding => Images
Topic: show Image from URL with image ID -syntax question
Replies: 1
Views: 103

Re: show Image from URL with image ID -syntax question

Code: Select all

'http://www.kiva.org/img/'
 http://www.kiva.org/img/
You've closed the filename in the second line.
by hyper
Tue Nov 06, 2018 1:17 pm
Forum: PHP coding => General
Topic: How to repeat PHP script with updated variables
Replies: 3
Views: 141

Re: How to repeat PHP script with updated variables

I think that your biggest problem could be with the script timing out, not sure as it depends where you are getting the files from? It might be a solution to set up a cron job rather than a loop to execute the script, to do the transfers and mark the database when the file has been successfully down...