Basic Concept and Programming a Modelling Neurons (AND – OR Function) in PHP

Basic Concept and Programming a Modelling Neurons (AND – OR Function) in PHP


Neural Network, Figure taken from


Intelligent Computing is a computation tools that inspired from traditional computation methodology for handling the real-world problems are statistic modelling principal which is not efective and feasible. Intelligent computing provides solution to handling a uncertainty problem, noise, and context that always change, such as neural network, evolution computation and fuzzy logic. Intelligent computing also examines inspired algorithms biologically likes swarm intelligence and artificial immune system that can look as part of evolution computation. The wide domain area of research such as image, data mining, and natural language processing.

Neural Network

Since 1943 Warren McCulloch and Walter Pitts formulated a mathematical models of brain cells, it was developed based on biological neural system. Brain is consist of neuron and synapsis (communicator) that works based on impulse (signal). The humans have 1012 neurons and 6.1018 synapses to recognize patterns, execute calculation, and control the organs of body. Furthemore, it has ability to make a patterns based on experience.


Human neuron

The figure above described :

  • Nucleus is a core of neuron.
  • Dendrites serves to transmit impulses received into the body of the nerve cell.
  • Axon serves to transmit impulses from the cell body to another network.
  • Synapsis serves as a functional unit between two nerve cells.

 The comparison between humain brain and Neural Network:

Human Brain Neural Network
Soma Node
Dendrites Input
Axon Output
Synapsis Weight
Billions of neurons Hundreds of neurons

Nueral Network useful for:

  • Classifying patterns.
  • Mapping patterns obtained from the input into a new pattern in the output.
  • Collecting patterns to be called back.
  • Mapping similar patterns
  • Optimizing problems
  • Predicting

Neural Network Structure:


Neural Network Structure

  • Information (as input) was sent to the neuron through a weighting input.
  • Input was processed by the propagation functions that increase the  input weights values.
  • The results were compared with a threshold by activation function.
  • If the inputs exceed the threshold, then the neurons will be activated, otherwise the neurons will inhibit.
  • When activated, the neuron will send output through weighting output to other neurons

Simple cases in AND and OR function/operation for modelling neuron:

AND Operation

AND function

AND operation

The modelling neuron using AND operation can be interpreted how information (as input) was sent to the neuron through a weighting input.

  • x1,x2 as input, w1,w2 as weighting input, teta as threshold, and y as output.
  • All values were assigned for modelling AND function.
  • For examples, x1=1, x2=1 while w1=1, w2=1. Then, output =  (x1*w1) + (x2*w2) = (1*1) + (1*1) = 1+1=2.  If output more or equal than threshold,which threshold was assigned 2, then y value is 1, else then y value is 0. Because output value is 2 and threshold is 2, output is equal with threshold, therefore y is 1 as final class output.

You can follow the source code below, please re-type for understanding this discussion.


AND operation – part 1 of code


AND operation – part 2 of code

OR Operation

OR function

OR operation

The modelling neuron using OR operation is not much different with AND operation, In OR operation only changed the weighting input that assigned w1,w2=2 to get the different y class output compared AND operation.

Anyone want to try the OR operation  in PHP ? Please comment, if you have been finished it.


The next post, I will discuss about XOR.

Don’t miss it.

Thank you.


1,522 total views, 1 views today

Be Sociable, Share!

Leave a Reply

Your email address will not be published. Required fields are marked *