Search found 584 matches

by chorn
Wed Feb 27, 2019 2:09 am
Forum: PHP General
Topic: How to change a date via a variable
Replies: 3
Views: 147

Re: How to change a date via a variable

there's a shorter, more flexible and human readable way with the DateTime class, e.g.

Code: Select all

<?php

$date = new DateTime('2014-06-01 14:00:00');
print_r($date);

$date->modify('+1 hours');
print_r($date);

$date->modify('+12 minutes');
print_r($date);

$date->modify('+123 years');
print_r($date);
by chorn
Sun Feb 03, 2019 10:34 pm
Forum: PHP General
Topic: contact form - check ip blacklist
Replies: 2
Views: 120

Re: contact form - check ip blacklist

At least i don't see you using the service anywhere. You can create simple GET request with file_get_contents() on an URL and get a string back. as it seems to be JSON, you can parse the result with json_decode().
by chorn
Wed Jan 30, 2019 10:56 pm
Forum: PHP coding => General
Topic: Hiding passwords
Replies: 6
Views: 278

Re: Hiding passwords

If you can configure where the domain of your projects leads to, you should use a sub-directory as the entry point and place all other files obove this directory, e.g. /files /config db.php <-- store password here /www index.php <-- set your domain to this point so even if the webserver struggles, n...
by chorn
Tue Jan 29, 2019 2:39 am
Forum: PHP coding => General
Topic: Comparing two arrays and extracting values
Replies: 6
Views: 288

Re: Comparing two arrays and extracting values

That makes no sense for me. If you're using SQL you have build-in sorting funtionality with ORDER BY. But that collides with your NC-value, because that's not a number, so your table layout may be wrong. If you want to "ignore" these values, just set an apprpriate WHERE condition.
by chorn
Tue Jan 29, 2019 2:34 am
Forum: PHP coding => General
Topic: PDF files from PHP mail function not opening
Replies: 1
Views: 118

Re: PDF files from PHP mail function not opening

why dont you use some wrapper like PHPMailer? It's really straigth forward and deals with a lot of problems very well.
by chorn
Fri Jan 25, 2019 4:47 am
Forum: PHP coding => General
Topic: Comparing two arrays and extracting values
Replies: 6
Views: 288

Re: Comparing two arrays and extracting values

So you got a list of needed functions, did you try any?
by chorn
Fri Jan 25, 2019 4:14 am
Forum: PHP coding => General
Topic: Comparing two arrays and extracting values
Replies: 6
Views: 288

Re: Comparing two arrays and extracting values

What does "top 5" mean, any sorting by number?

array_combine
ksort
array_keys
array_values
array_sum

https://secure.php.net/manual/en/ref.array.php
by chorn
Tue Jan 22, 2019 4:42 am
Forum: PHP coding => General
Topic: Parsing a json
Replies: 14
Views: 534

Re: Parsing a json

just have a look at print_r($datas) and you see "tables" is previously contained by another key. Tip: you're missing something from your first code. Protip: you may want to use array_column() instead.
by chorn
Tue Jan 22, 2019 2:34 am
Forum: PHP coding => General
Topic: Parsing a json
Replies: 14
Views: 534

Re: Parsing a json

[tables] => Array ( [0] => stdClass Object ( [tableName] => Unique League Table [table] => Array ( [0] => stdClass Object ( [teamName] => Liverpool on each item from "tables" you have a key "table" which you can iterate over again and read the key "teamName" foreach($datas['tables'] as $table){ for...
by chorn
Tue Jan 22, 2019 2:17 am
Forum: PHP coding => General
Topic: Parsing a json
Replies: 14
Views: 534

Re: Parsing a json

If you print_r($Datas) you see there's a key called "tables" you could iterate over with foreach().
by chorn
Tue Jan 22, 2019 1:10 am
Forum: PHP coding => General
Topic: Parsing a json
Replies: 14
Views: 534

Re: Parsing a json

Then post an example with var_export.
by chorn
Tue Jan 22, 2019 12:44 am
Forum: PHP coding => General
Topic: Parsing a json
Replies: 14
Views: 534

Re: Parsing a json

Just post a valid example.
by chorn
Tue Jan 22, 2019 12:10 am
Forum: PHP coding => General
Topic: Parsing a json
Replies: 14
Views: 534

Re: Parsing a json

vasomik wrote:
Tue Jan 22, 2019 12:00 am
and print_r($decoded) that gived me the whole array!
No it does not, just tested:

https://3v4l.org/3etl2

or your example is invalid.
by chorn
Mon Jan 21, 2019 11:51 pm
Forum: PHP coding => General
Topic: Parsing a json
Replies: 14
Views: 534

Re: Parsing a json

that's no JSON, at least the quotes for the keys are missing.
by chorn
Thu Jan 17, 2019 11:31 pm
Forum: PHP coding => General
Topic: How to read incoming csv text data to PHP page and display it
Replies: 3
Views: 213

Re: How to read incoming csv text data to PHP page and display it

so you have a solution now, is there any problem left?
by chorn
Mon Jan 14, 2019 11:26 pm
Forum: PHP coding => General
Topic: date_diff
Replies: 3
Views: 216

Re: date_diff

Use the DateTime class, it has a diff-function.
by chorn
Sun Dec 30, 2018 5:56 am
Forum: PHP coding => General
Topic: A Laravel app that implements a JSON API
Replies: 1
Views: 189

Re: A Laravel app that implements a JSON API

Step 1: Download Laravel.
by chorn
Sun Dec 16, 2018 11:56 pm
Forum: PHP coding => General
Topic: How to install PHP Open Source like Wordpress
Replies: 1
Views: 238

Re: How to install PHP Open Source like Wordpress

do it as the documentation says.
by chorn
Sun Dec 16, 2018 11:55 pm
Forum: PHP coding => General
Topic: WP Job Manager Snippet do not work: “Make custom meta field searchable”
Replies: 2
Views: 320

Re: WP Job Manager Snippet do not work: “Make custom meta field searchable”

but it is not searchable
what should that mean for anyone not familar with your task? what`s the technical specification of "searchable" in this context?
by chorn
Wed Dec 12, 2018 12:14 am
Forum: PHP coding => General
Topic: Rolling 6 different dice...
Replies: 7
Views: 522

Re: Rolling 6 different dice...

just have a look if array_unique changes your data.
by chorn
Wed Nov 28, 2018 2:35 am
Forum: PHP General
Topic: mobile device detect
Replies: 2
Views: 326

Re: mobile device detect

what for.
by chorn
Fri Oct 19, 2018 9:00 am
Forum: PHP General
Topic: Open PDF on page nr 13
Replies: 4
Views: 482

Re: Open PDF on page nr 13

and you are sure it's the adobe reader that opens, and not the viewer of the browser (firefox and chrome have their own, no need to install adobe reader)?
by chorn
Fri Oct 19, 2018 2:19 am
Forum: PHP General
Topic: Open PDF on page nr 13
Replies: 4
Views: 482

Re: Open PDF on page nr 13

who said this could work this way?
by chorn
Sun Sep 30, 2018 11:27 pm
Forum: PHP coding => General
Topic: Simple Form Post with PHP to another Server
Replies: 3
Views: 577

Re: Simple Form Post with PHP to another Server

Have a look in your servers logfiles, there must be a more specific error message.