%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass{article}
\usepackage{array}
\makeatletter
\TeXXeTstate=1

\def\tabular{\gdef\@halignto{}\@tabular}

\def\@tabular{%
 \leavevmode
 \hbox\bgroup
   $%
   \@tabularinit
   \@array
}

\renewcommand\@array[2][c]{%

   \@tempdima \ht \strutbox
   \advance \@tempdima by\extrarowheight
   \setbox \@arstrutbox \hbox{%
     \vrule \@height \arraystretch \@tempdima
            \@depth  \arraystretch \dp \strutbox
            \@width  \z@
   }%
   \begingroup
     \@mkpream{#2}%
     \xdef\@preamble{%
       \noexpand \ialign \@halignto
       \bgroup \@arstrut \@preamble
         \tabskip \z@ \cr
     }%
   \endgroup
   \@arrayleft
   \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi
   \bgroup
     \@arrayinit

     \hbox\bgroup\beginR\vbox\bgroup
       \@preamble
         % indent
}
%% environment body goes here
\def\endtabular{%
         \crcr
       \egroup % \bgroup from \@preamble
     \egroup\endR\egroup % \vbox\hbox
   \egroup
   \gdef\@preamble{}%
   $%
 \egroup % original \hbox
}

\def\@tabularinit{%

   \col@sep\tabcolsep
   \let \d@llarbegin \begingroup
   \let \d@llarend \endgroup
}
\def\@arrayinit{%

   \let \@sharp ##
   \let \protect \relax
   \lineskip \z@
   \baselineskip \z@
   \m@th
   \let \\ \@arraycr
   \let \tabularnewline \\%
   \let \par \@empty
}
\makeatother
\begin{document}
\begin{tabular}{|l|l|}\hline
vafa khalighi&shahrzad khalighi\\ \hline
\end{tabular}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
