Skip to main content

PHP Collective

A collective where developers working with PHP can learn and connect about the open source scripting language.
1.5m Questions
+303
10.9k Members
+108
Contact

Pinned content

View all 3 collections

PHP admins have deemed these posts noteworthy.

Pinned
23 votes
5k views
Collection

Common Mistakes to Avoid in PHP

A list of real issues most beginners encounter when using PHP.
Sasha's user avatar
  • 101
Pinned
44 votes
3k views
2 minute read
How-to guide

Start learning PHP — Useful resources for beginners and advanced

Start learning PHP — Useful resources for beginners and advanced! If you're wondering where to start from learning the PHP language or needing some more knowledge to deep dive into the language, you ...
RB Projects's user avatar

Can you answer these questions?

View all unanswered questions

These questions still don't have an answer

0 votes
0 answers
6 views

Why is openssl_pkey_export_to_file returning false while openssl_pkey_export works?

Could there be any reason why openssl_pkey_export_to_file() returns false every time, whereas, in the same case, openssl_pkey_export() works? Working code excerpt: $sslKeys = openssl_pkey_new(...
0 votes
0 answers
12 views

The GET method is not supported for this route. Supported methods: HEAD.?

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException The GET method is not supported for this route. Supported methods: HEAD. I keep getting this error when trying to upload my Laravel ...
0 votes
0 answers
11 views

WooCommerce Checkout totals only update when page is reloaded twice

I set shipping total and total via AJAX: add_action('wp_ajax_wc_shipper_set_rate', 'wc_shipper_set_rate'); add_action('wp_ajax_nopriv_wc_shipper_set_rate', 'wc_shipper_set_rate'); function ...
1 vote
0 answers
10 views

Issues with Custom Walker_Nav_Menu for Columns in WordPress Navigation Menus

I'm trying to create a custom navigation menu in WordPress that uses invisible columns as containers for second-level menu items. I'm using a custom class that extends Walker_Nav_Menu, but I'm having ...
0 votes
0 answers
24 views

I am struggling to get prefill data while editing document in php

<?php session_start(); include '../config.php'; // Check if user is logged in if (!isset($_SESSION['id'])) { echo ("<script LANGUAGE='JavaScript'> window.alert('Please ...

Looking for an extra challenge?

View all bountied questions

These questions have a bounty on them

1 vote
0 answers
70 views
+50

How to correctly encode special characters when programmatically creating ACF Gutenberg-Blocks in Wordpress?

I am building an importer for a wordpress project and have to map blocks to other block types. Therefore, I have an abstract base Block-Class that looks like this: abstract class Block { abstract ...
0 votes
0 answers
39 views
+50

How to set the first order status as a custom status for newly created orders from Woocommerce Rest API?

We use a platform called BaseLinker, which sends orders from other marketplaces to our WooCommerce store through Rest API. The problem is that initially the orders have a status of "Payment ...

Learn something new
These are the most recent articles in PHP Collective
4 votes
224 views
1 minute read
How-to guide

How to trim &nbsp; (or non-breaking space) in PHP?

The main problem is the way trim() function works. One cannot reliably trim a substring using this function, because it takes its second argument as a collection of characters, each of which would be ...
Your Common Sense's user avatar
21 votes
56k views
3 minute read
Knowledge article

Evolution of Type Declarations in PHP

Introduction: PHP, being a dynamically typed language, traditionally allowed flexibility in variable types, providing both advantages and challenges in code maintenance and robustness. However, with ...
alkhatibdev's user avatar
44 votes
3k views
2 minute read
How-to guide

Start learning PHP — Useful resources for beginners and advanced

Start learning PHP — Useful resources for beginners and advanced! If you're wondering where to start from learning the PHP language or needing some more knowledge to deep dive into the language, you ...
RB Projects's user avatar